Turn sketch circle to construction line using iLogic

Turn sketch circle to construction line using iLogic

lance.burrows
Participant Participant
381 Views
3 Replies
Message 1 of 4

Turn sketch circle to construction line using iLogic

lance.burrows
Participant
Participant

Most of what I draw are circular parts with either circular or square bolt holes. To save time I've made a custom part template that has a sketch containing most of the features used, including both the circle & square bolt hole in their starting position as construction lines. Currently I right click on the circle/square and turn the construction line(s) off then make the circular pattern.

 

Can iLogic toggle specific construction line(s) in a sketch on & off? I've got the iLogic form working for sketch dimensions, but not this.

 

I've used iLogic dimensioning in drawings with Capture Current State where I can select specific lines, but I'm not seeing a similar feature for sketches.

 

I'm using Inventor 2023

0 Likes
Accepted solutions (1)
382 Views
3 Replies
Replies (3)
Message 2 of 4

Michael.Navara
Advisor
Advisor

Try to use something like this

Sub Main()
    'Planar sketch must be active
    Dim oSketch As PlanarSketch = ThisApplication.ActiveEditObject

    MakeCirclesAsConstruction(oSketch, True)
End Sub

Private Sub MakeCirclesAsConstruction(oSketch As PlanarSketch, construction As Boolean)
    For Each oCircle As SketchCircle In oSketch.SketchCircles
        If Not oCircle.Construction = construction Then oCircle.Construction = construction
    Next
End Sub
Message 3 of 4

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi @lance.burrows 

 

If you have multiple circles in a sketch you can use something like this initially just to determine where the circle is in the circles collection ( is it item 1, is it item 2, etc?)

 

Dim oDoc As PartDocument
oDoc = ThisDoc.Document

Dim oSketch As PlanarSketch 
oSketch = oDoc.ComponentDefinition.Sketches.Item("Sketch1")

Dim sSet As SelectSet
sSet = oDoc.SelectSet

i = 1
For Each oCircle As SketchCircle In oSketch.SketchCircles
	sSet.Select(oCircle)
	MsgBox("This is oSketch.SketchCircles.item(" & i & ")")
	sSet.Clear
	i = i+1
Next

 

Once you know the circle item number, you can just use something like this to toggle it.

 

oCirlce = ThisDoc.Document.ComponentDefinition.Sketches.Item("Sketch1").SketchCircles.Item(2)
oCirlce.Construction = Not oCirlce.Construction

 

I hope this helps.
Best of luck to you in all of your Inventor pursuits,
Curtis
http://inventortrenches.blogspot.com

EESignature

0 Likes
Message 4 of 4

lance.burrows
Participant
Participant

@Curtis_Waguespack 

 

This works perfect, thanks!

0 Likes