Is there some simple way to get the sketch number of the active sketch in either part or assembly?
I understand the document.sketchactive boolean but this doesnt allow me to find which sketch in the collection is the active one.
Hi CadUser46,
I use something like this in iLogic to find the active sketch name:
Dim oSketch As PlanarSketch If Typeof ThisApplication.ActiveEditObject Is Sketch Then oSketch = ThisApplication.ActiveEditObject MessageBox.Show(oSketch.Name & " is the active Sketch", "iLogic") Else MessageBox.Show("Active Edit Object is not a Sketch", "iLogic") End If
There might be a better way, but this is what I had handy.
It occurred me after I posted the above that we could so something like this to find the active sketch number as you requested:
Dim oSketches As PlanarSketches oSketches = ThisApplication.ActiveDocument.ComponentDefinition.Sketches i=1 For Each oSketch in oSketches oSketch = oSketches.Item(i) If oSketch Is ThisApplication.ActiveEditObject Then MessageBox.Show("The active sketch is number: " & i, "iLogic") Else End If i=i+1 Next
I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com
As sketch number in the sketches collection could be changed it is safer to use Sketch.Name property to reference the particular Sketch.