Sketch consumption by PartFeature (browser tree analysis)

Sketch consumption by PartFeature (browser tree analysis)

Maxim-CADman77
Advisor Advisor
543 Views
1 Reply
Message 1 of 2

Sketch consumption by PartFeature (browser tree analysis)

Maxim-CADman77
Advisor
Advisor

I'm composing iLogic rule that should inform user whether the IPT has any sketch that was not used for creating Solid/Surface Bodies (return Sketch Name if any).

Initially I thought I would use Sketch.Parent property value but now I don't think it was good idea because it only returns Part or SheetMetal Component definition enumerator.

Now I think the fastest way would be to analyse browser tree (check if there is any parent PartFeature object for each Sketch) but i lack experience of processing the model-tree. Till now I have this:

Dim oSketch As Sketch
Dim oCompDef As PartComponentDefinition
oCompdef = ThisApplication.ActiveDocument.ComponentDefinition
Dim oControlDef As ControlDefinition
oControlDef = ThisApplication.CommandManager.ControlDefinitions.Item("AppFindInBrowserCtxCmd")

For each oSketch in oCompDef.Sketches
	ThisApplication.ActiveDocument.SelectSet.Clear
	ThisApplication.ActiveDocument.SelectSet.Select(oSketch)
	oControlDef.Execute
	MsgBox(oSketch.Name) ' Comment after debugging
'if ??? Then  MsgBox (oSketch.Name): Exit For	
Next

Could somebody hint what should I put instead "???" to achieve my goal  ?

Please vote for Inventor-Idea Text Search within Option Names

0 Likes
Accepted solutions (1)
544 Views
1 Reply
Reply (1)
Message 2 of 2

chandra.shekar.g
Autodesk Support
Autodesk Support
Accepted solution

@Maxim-CADman77,

 

Hoping that below iLogic code might help to determine sketch which is not used for solid body.

Dim oSketch As Sketch
Dim oCompDef As PartComponentDefinition
oCompDef = ThisApplication.ActiveDocument.ComponentDefinition
 
For Each oSketch In oCompDef.Sketches
	If oSketch.Consumed = False Then
		MessageBox.Show("Name of sketch which is not used to create solid body : "+oSketch.Name, "Sketch name")
	End If	
Next

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes