Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Select and activate sketch via iLogic

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
mk92
2047 Views, 3 Replies

Select and activate sketch via iLogic

Hello,

 

is there a way to select and activate a sketch with iLogic? The best way would be to usw them in the rule with their names is this possible?

 

Like: There are three sketches

 

If x = 1 then

activate sketch_1 and do whatever

End If

 

If x = 2 then...

 

In addition I would like to know if it is possible to create a sketch with iLogic and make form like a rectangle in it?

 

Any Ideas or questions?

 

Thanks in advance

Tags (2)
3 REPLIES 3
Message 2 of 4
LukeDavenport
in reply to: mk92

 

Hi MK92,
Paste the rule below into a part file, with a multi-value text parameter called TestParam, with values 'A', 'B', 'C', 'D'. Create 4 sketches in the part called Sketch1, Sketch2, Sketch3 and Sketch4. When you switch the value of that parameter it'll activate different sketches.

Does that help?
Luke

Dim
oSketches As PlanarSketches = ThisApplication.ActiveEditDocument.ComponentDefinition.Sketches ' Exit active sketch if we are currently editing a sketch
If TypeOf ThisApplication.ActiveEditObject Is Sketch Then ' Set a reference to the active sketch.
Dim oSketch As Sketch = ThisApplication.ActiveEditObject oSketch.ExitEdit End If Select Case TestParam Case "A" oSketches("Sketch1").Edit Case "B" oSketches("Sketch2").Edit Case "C" oSketches("Sketch3").Edit Case "D" oSketches("Sketch4").Edit End Select
Message 3 of 4
mk92
in reply to: LukeDavenport

Works fine! Thank you very much.

 

But out of interest, i dont need it but would like that feature, is there a way to bring a form like a rectangle or a block in this sketch?

Message 4 of 4
LukeDavenport
in reply to: mk92

There's tons on info on programmatically drawing in sketches in the
programming help inside Inventor. Have a google on this.
Luke

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report