- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
With the help of this forum, I have the following rule which works great a the part level, external rule.
My users though, have tried to run the rule while in an assembly, editing the part in place. The rule as written adds the parameters at the assembly level, not to the activated part file.
Can one of you gurus show me how to have my rule apply the parameters to the part that is being edited not the assembly that the part was accessed from?
Thank you in advance,
Kenny
Format:HTML Format Version:1.0 StartHTML: 165 EndHTML: 6532 StartFragment: 314 EndFragment: 6500 StartSelection: 314 EndSelection: 314SyntaxEditor Code Snippet
Sub Main() Dim oDoc As PartDocument oDoc=ThisApplication.ActiveDocument Dim oUserParam1 As UserParameter oUserParam1=oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("CMF_COORD_X", 0, UnitsTypeEnum.kFootLengthUnits) Dim oUserParam2 As UserParameter oUserParam=oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("CMF_COORD_Y", 0, UnitsTypeEnum.kFootLengthUnits) Dim oUserParam3 As UserParameter oUserParam3=oDoc.ComponentDefinition.Parameters.UserParameters.AddByValue("CMF_COORD_Z", 0, UnitsTypeEnum.kFootLengthUnits) End Sub
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hey Kenny, here you go:
Sub Main()
Dim oDoc As Object = ThisApplication.ActiveEditObject
If Not TypeOf oDoc Is PartDocument Then Exit Sub
Dim oUP As UserParameters = oDoc.ComponentDefinition.Parameters.UserParameters
Dim oUP1 As UserParameter = oUP.AddByValue("CMF_COORD_X", 0, UnitsTypeEnum.kFootLengthUnits)
Dim oUP2 As UserParameter = oUP.AddByValue("CMF_COORD_Y", 0, UnitsTypeEnum.kFootLengthUnits)
Dim oUP3 As UserParameter = oUP.AddByValue("CMF_COORD_Z", 0, UnitsTypeEnum.kFootLengthUnits)
End Sub
- - - - - - - - - - - - - - -
Regards,
Mike
"Always code as if the guy who ends up maintaining your code will be a violent psychopath who knows where you live." - John F. Woods
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Worked like a charm. Thank you.
I appreciate you showing me how to clean up my code a bit, too.
Very much appreciated, Mike!
Kenny