
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everybody,
I need some help with the following issue.
I wrote a rule wich generally works fine.
-The rule checks in wich direction the part is in the workspace, and create a new sketch.
-rename the sketch to identify
-create a iProperty for the edgelenght of the projected edges, measure the value, and set to the iProperty
-close and delete the sketch.
If i fire the rule in the part...everything works
If i fire the rule as a external rule in the part...everything works
But
if i fire the rule from the assembly (run rule in component comand) then the edges will not be projected and the rule stops working.
the same if i fire the rule as an external rule from top level assembly
I need this for cuting time calculation of the hole assembly, so later i add all the loops measured an have a time for the cuttind duration of all the parts. 😉
Any help would be great!
I m sure the error occures in the control definition of the project comand, but i dont know how and why!
I add a simple assembly for demonstrating the problem as zip.
Thanks
Simon
SyntaxEditor Code Snippet
'Set all to Zero iProperties.Value("Custom", "X")=Round(Measure.ExtentsLength) iProperties.Value("Custom", "Y")=Round(Measure.ExtentsWidth) iProperties.Value("Custom", "Z")=Round(Measure.ExtentsHeight) iProperties.Value("Custom", "Loop")=0 iProperties.Value("Custom", "Loop_SETM")=0 iProperties.Value("Custom", "Loop_SELM")=0 Dim opartDoc As Inventor.PartDocument opartDoc = ThisDoc.Document ' Set a reference to the part component definition. Dim oCompDef As PartComponentDefinition oCompDef = oPartDoc.ComponentDefinition ' Create a new sketch on plane` 'Get the orientation Of the Part_______________________XYZ If MinOfMany(iProperties.Value("Custom", "X"),iProperties.Value("Custom", "Y"),iProperties.Value("Custom", "Z"))=iProperties.Value("Custom", "Z") Then n=3 Else If MinOfMany(iProperties.Value("Custom", "X"),iProperties.Value("Custom", "Y"),iProperties.Value("Custom", "Z"))=iProperties.Value("Custom", "Y") Then n=2 Else If MinOfMany(iProperties.Value("Custom", "X"),iProperties.Value("Custom", "Y"),iProperties.Value("Custom", "Z"))=iProperties.Value("Custom", "X") Then n=1 End If Dim oSketch1 As PlanarSketch oSketch1 = oCompDef.Sketches.Add(oCompDef.WorkPlanes.Item(n)) 'edit the Sketch oSketch1.Edit ' Set a reference To the transient geometry Object. Dim oTransGeom As TransientGeometry oTransGeom = ThisApplication.TransientGeometry 'project cut edges Dim oDef As ControlDefinition oDef = ThisApplication.CommandManager.ControlDefinitions.Item("SketchProjectCutEdgesCmd") oDef.Execute 'close Sketch oSketch1.ExitEdit 'Rename the Sketch To identify oSketch1.Name = "Temp_Loop" 'Write the Loop To the iproperty iProperties.Value("Custom", "Loop")=Measure.Perimeter("Temp_Loop") RuleParametersOutput() 'delete the Sketch oSketch1.Delete opartDoc.Update() InventorVb.DocumentUpdate()
Solved! Go to Solution.