change sketch number in part ipt

change sketch number in part ipt

marcin_bargiel
Advocate Advocate
138 Views
2 Replies
Message 1 of 3

change sketch number in part ipt

marcin_bargiel
Advocate
Advocate

Is it a way to change sketch number in part ipt?

 

This code simply list numbers and names :

Dim oModel As PartDocument
oModel = ThisDoc.Document
Dim oDestDef As PartComponentDefinition
oDestDef = oModel.ComponentDefinition
Dim oSketch As Sketch
For i = 1 To oModel.ComponentDefinition.Sketches.Count
	oSketch = oModel.ComponentDefinition.Sketches(i)
	Logger.Info(i & " : " & oSketch.Name)
Next

  INFO|1 : sketch_MAIN
INFO|2 : sketch_schedule
INFO|3 : sketch_nozzle
INFO|4 : sketch_hole
INFO|5 : sketch_rosette
INFO|6 : sketch_hub

 

So, all I want to achieve is to change (move) sketch_hole no. 4 to number 5!

And so on: 5 → 6; 6 → 7.

Unfortunately, if I move EOP before sketch no. 4 and add a new sketch, this sketch will get the last number.

I need this because other rules refer to the sketch numbers (and not to the name, which is being changed).

 

Vote for REPLACE VARIES !
REPLACE VARIES
0 Likes
139 Views
2 Replies
Replies (2)
Message 2 of 3

C_Haines_ENG
Collaborator
Collaborator

So you want to change the way Inventor is listing the sketches in the order in which you have them in the design tree, and not in the order they were created?

0 Likes
Message 3 of 3

C_Haines_ENG
Collaborator
Collaborator

If you want to cycle through sketches in your drawing based on their position in the model browser instead of their creation you can use this:

Dim oDoc As PartDocument = ThisDoc.Document
Dim oTN As BrowserNode = oDoc.BrowserPanes.Item("PmDefault").TopNode

For Each oBN As BrowserNode In oTN.BrowserNodes

	If oBN.NativeObject Is Nothing Then Continue For

	If oBN.NativeObject.Type = ObjectTypeEnum.kPlanarSketchObject

		Logger.Info(oBN.BrowserNodeDefinition.Label)

	End If

Next
0 Likes