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: 

iLogic Sketch Creation

13 REPLIES 13
SOLVED
Reply
Message 1 of 14
Anonymous
7093 Views, 13 Replies

iLogic Sketch Creation

Anonymous
Not applicable

Hello guys,

 

I am new to this forum as well as to iLogic.

From my research on google and on this forum i have some questions about iLogic.

 

What I would like to ask you is the following:

 

Is it possible to create a sketch using iLogic?

 

If yes , how ?

 

If not, is it possible to create (for example) a line inside a sketch ?

 

I am sorry if this is too fundamental but after a day of searching i haven't come up with an answer..

iLogic Sketch Creation

Hello guys,

 

I am new to this forum as well as to iLogic.

From my research on google and on this forum i have some questions about iLogic.

 

What I would like to ask you is the following:

 

Is it possible to create a sketch using iLogic?

 

If yes , how ?

 

If not, is it possible to create (for example) a line inside a sketch ?

 

I am sorry if this is too fundamental but after a day of searching i haven't come up with an answer..

13 REPLIES 13
Message 2 of 14
emaiolino
in reply to: Anonymous

emaiolino
Advocate
Advocate

Dear Tefkleidis,
Then I'll show you what I understood from your query
- Once done the "Sketch", proceed to the "Manage" tab:

 

005.png

- Once there, deploy "Ilogic" which is where you can add the form or manage the necessary rules:

 

004.png

- You can work from "Parameters" yes you need:

003.png

 

This is what you needed?



Esteban Maiolino
Titular EMBA Proyectos
Sitio web o nombre del blog
Facebook | Twitter | LinkedIn

0 Likes

Dear Tefkleidis,
Then I'll show you what I understood from your query
- Once done the "Sketch", proceed to the "Manage" tab:

 

005.png

- Once there, deploy "Ilogic" which is where you can add the form or manage the necessary rules:

 

004.png

- You can work from "Parameters" yes you need:

003.png

 

This is what you needed?



Esteban Maiolino
Titular EMBA Proyectos
Sitio web o nombre del blog
Facebook | Twitter | LinkedIn

Message 3 of 14
Anonymous
in reply to: Anonymous

Anonymous
Not applicable

Thank you very much for your answer but this is not exactly what i need.

 

Using the way you showed me, you have a rectangle created and you are able to modify the lengths of it's sides.

 

What I need to do, is create the rectangle from scratch. That is, having an empty sketch to go and create a rectangle and then assign user made parameters to define the lengths of it's sides.

0 Likes

Thank you very much for your answer but this is not exactly what i need.

 

Using the way you showed me, you have a rectangle created and you are able to modify the lengths of it's sides.

 

What I need to do, is create the rectangle from scratch. That is, having an empty sketch to go and create a rectangle and then assign user made parameters to define the lengths of it's sides.

Message 4 of 14
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
You can generate sketches then suppress them, to be unsuppressed when required. We use ilogic to turn on and off features and have ilogic define geometry depending on selection.


For instance, to turn a feature on and off we use "feature is active"

on-
Feature.IsActive("SRStrike Jamb:1", "Deadlock Strike Square") = True

off-
Feature.IsActive("SRStrike Jamb:1", "Deadlock Strike Square") = False

then use parameters to control the size depending on what is required.

I don't know how to generate from scratch using ilogic, can you set up some blanks that can be turned on and off when needed?

0 Likes

You can generate sketches then suppress them, to be unsuppressed when required. We use ilogic to turn on and off features and have ilogic define geometry depending on selection.


For instance, to turn a feature on and off we use "feature is active"

on-
Feature.IsActive("SRStrike Jamb:1", "Deadlock Strike Square") = True

off-
Feature.IsActive("SRStrike Jamb:1", "Deadlock Strike Square") = False

then use parameters to control the size depending on what is required.

I don't know how to generate from scratch using ilogic, can you set up some blanks that can be turned on and off when needed?

Message 5 of 14
Curtis_Waguespack
in reply to: Anonymous

Curtis_Waguespack
Consultant
Consultant
Accepted solution

Hi tefkleidis,

 

Here are 3 quick examples adapted from the Inventor API samples.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

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

 

 

Example 1

Draw 3 lines to make a Triangle example:

 

' Check to make sure a sketch is open.
If Not TypeOf ThisApplication.ActiveEditObject Is PlanarSketch Then
MessageBox.Show("A sketch must be active.", "iLogic")
Return
End If

'set a reference to the active sketch.
Dim oSketch As PlanarSketch
oSketch = ThisApplication.ActiveEditObject

'set a reference to the transient geometry collection.
Dim oTransGeom As TransientGeometry
oTransGeom = ThisApplication.TransientGeometry

' Create a new transaction to wrap the construction of the three lines
' set into a single undo.
Dim oTrans As Transaction
oTrans = ThisApplication.TransactionManager.StartTransaction( _
ThisApplication.ActiveDocument, _
"Create Triangle Sample")

' Create the first line of the triangle. This uses two transient points as
' input to definethe coordinates of the ends of the line. Since a transient
' point is input a sketch point is automatically created at that location and
' the line is attached to it.
Dim oLines(0 To 2) As SketchLine
oLines(0) = oSketch.SketchLines.AddByTwoPoints(oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d(4, 0))

' Create a sketch line that is connected to the sketch point the previous lines
' end point is connected to. This will automatically create the constraint to
' tie the new line to the sketch point the previous line is also connected to.
' This will result in the the two lines being connected since they're both tied
' to the same sketch point.
oLines(1) = oSketch.SketchLines.AddByTwoPoints(oLines(0).EndSketchPoint, _
oTransGeom.CreatePoint2d(2, 3))

' Create a third line and connect it to the start point of the first line and the
' end point of the second line. This will result in a connected triangle.
oLines(2) = oSketch.SketchLines.AddByTwoPoints(oLines(1).EndSketchPoint, _
oLines(0).StartSketchPoint)

' End the transaction
oTrans.End

iLogicVb.UpdateWhenDone = True

 

Example 2

2 Point Rectangle example:

 

' Check to make sure a sketch is open.
If Not TypeOf ThisApplication.ActiveEditObject Is PlanarSketch Then
MessageBox.Show("A sketch must be active.", "iLogic")
Return
End If

'set a reference to the active sketch.
Dim oSketch As PlanarSketch
oSketch = ThisApplication.ActiveEditObject

'set a reference to the transient geometry collection.
Dim oTransGeom As TransientGeometry
oTransGeom = ThisApplication.TransientGeometry

' Create a rectangle 
Dim oRectangleLines As SketchEntitiesEnumerator
oRectangleLines = oSketch.SketchLines.AddAsTwoPointRectangle( _
oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d(8, 5))

iLogicVb.UpdateWhenDone = True

 

Example 3

3 Point (rotated) Rectangle example:

 

' Check to make sure a sketch is open.
If Not TypeOf ThisApplication.ActiveEditObject Is PlanarSketch Then
MessageBox.Show("A sketch must be active.", "iLogic")
Return
End If

'set a reference to the active sketch.
Dim oSketch As PlanarSketch
oSketch = ThisApplication.ActiveEditObject

'set a reference to the transient geometry collection.
Dim oTransGeom As TransientGeometry
oTransGeom = ThisApplication.TransientGeometry

' Create a rotated rectangle
oRectangleLines = oSketch.SketchLines.AddAsThreePointRectangle( _
oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d(7, 3), _
oTransGeom.CreatePoint2d(8, 8))

iLogicVb.UpdateWhenDone = True

 

Hi tefkleidis,

 

Here are 3 quick examples adapted from the Inventor API samples.

 

Also just as a tip, you can search and ask programming questions of this type on the Inventor Customization forum too:
http://forums.autodesk.com/t5/Autodesk-Inventor-Customization/bd-p/120

 

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

 

 

Example 1

Draw 3 lines to make a Triangle example:

 

' Check to make sure a sketch is open.
If Not TypeOf ThisApplication.ActiveEditObject Is PlanarSketch Then
MessageBox.Show("A sketch must be active.", "iLogic")
Return
End If

'set a reference to the active sketch.
Dim oSketch As PlanarSketch
oSketch = ThisApplication.ActiveEditObject

'set a reference to the transient geometry collection.
Dim oTransGeom As TransientGeometry
oTransGeom = ThisApplication.TransientGeometry

' Create a new transaction to wrap the construction of the three lines
' set into a single undo.
Dim oTrans As Transaction
oTrans = ThisApplication.TransactionManager.StartTransaction( _
ThisApplication.ActiveDocument, _
"Create Triangle Sample")

' Create the first line of the triangle. This uses two transient points as
' input to definethe coordinates of the ends of the line. Since a transient
' point is input a sketch point is automatically created at that location and
' the line is attached to it.
Dim oLines(0 To 2) As SketchLine
oLines(0) = oSketch.SketchLines.AddByTwoPoints(oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d(4, 0))

' Create a sketch line that is connected to the sketch point the previous lines
' end point is connected to. This will automatically create the constraint to
' tie the new line to the sketch point the previous line is also connected to.
' This will result in the the two lines being connected since they're both tied
' to the same sketch point.
oLines(1) = oSketch.SketchLines.AddByTwoPoints(oLines(0).EndSketchPoint, _
oTransGeom.CreatePoint2d(2, 3))

' Create a third line and connect it to the start point of the first line and the
' end point of the second line. This will result in a connected triangle.
oLines(2) = oSketch.SketchLines.AddByTwoPoints(oLines(1).EndSketchPoint, _
oLines(0).StartSketchPoint)

' End the transaction
oTrans.End

iLogicVb.UpdateWhenDone = True

 

Example 2

2 Point Rectangle example:

 

' Check to make sure a sketch is open.
If Not TypeOf ThisApplication.ActiveEditObject Is PlanarSketch Then
MessageBox.Show("A sketch must be active.", "iLogic")
Return
End If

'set a reference to the active sketch.
Dim oSketch As PlanarSketch
oSketch = ThisApplication.ActiveEditObject

'set a reference to the transient geometry collection.
Dim oTransGeom As TransientGeometry
oTransGeom = ThisApplication.TransientGeometry

' Create a rectangle 
Dim oRectangleLines As SketchEntitiesEnumerator
oRectangleLines = oSketch.SketchLines.AddAsTwoPointRectangle( _
oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d(8, 5))

iLogicVb.UpdateWhenDone = True

 

Example 3

3 Point (rotated) Rectangle example:

 

' Check to make sure a sketch is open.
If Not TypeOf ThisApplication.ActiveEditObject Is PlanarSketch Then
MessageBox.Show("A sketch must be active.", "iLogic")
Return
End If

'set a reference to the active sketch.
Dim oSketch As PlanarSketch
oSketch = ThisApplication.ActiveEditObject

'set a reference to the transient geometry collection.
Dim oTransGeom As TransientGeometry
oTransGeom = ThisApplication.TransientGeometry

' Create a rotated rectangle
oRectangleLines = oSketch.SketchLines.AddAsThreePointRectangle( _
oTransGeom.CreatePoint2d(0, 0), _
oTransGeom.CreatePoint2d(7, 3), _
oTransGeom.CreatePoint2d(8, 8))

iLogicVb.UpdateWhenDone = True

 

Message 6 of 14
Anonymous
in reply to: Anonymous

Anonymous
Not applicable
Accepted solution

Guys thank you very much for your answers! 

G.Hunter, that is ineed possible however it does not apply in my circumstance because i would like my sketches to have different features.. For example depending on the occasion, I would like a sketch with 1 point or 10 or 100. That is why I need a way to be able to create points.

Curtis, thank you as well. From what I understand after my searching and your answer the only way to do what I need is through VBA and not iLogic so I will give that a try!

0 Likes

Guys thank you very much for your answers! 

G.Hunter, that is ineed possible however it does not apply in my circumstance because i would like my sketches to have different features.. For example depending on the occasion, I would like a sketch with 1 point or 10 or 100. That is why I need a way to be able to create points.

Curtis, thank you as well. From what I understand after my searching and your answer the only way to do what I need is through VBA and not iLogic so I will give that a try!

Message 7 of 14
mcgyvr
in reply to: Anonymous

mcgyvr
Consultant
Consultant

It might help to describe exactly what you are trying to accomplish (maybe with some examples).. There might be other "better" ways to accomplish your task vs having to run/develope a program to do simple sketching.. 

 

You mentioned "points"... Have you looked into how Inventor can import point cloud data (like from a 3d scanner,etc..) ?.. Get your points into a suitable "point cloud data format" and voila.. Imports right into Inventor..no need to write any coding really.

https://www.youtube.com/watch?v=WTg62YbBbhA

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
0 Likes

It might help to describe exactly what you are trying to accomplish (maybe with some examples).. There might be other "better" ways to accomplish your task vs having to run/develope a program to do simple sketching.. 

 

You mentioned "points"... Have you looked into how Inventor can import point cloud data (like from a 3d scanner,etc..) ?.. Get your points into a suitable "point cloud data format" and voila.. Imports right into Inventor..no need to write any coding really.

https://www.youtube.com/watch?v=WTg62YbBbhA

 

 



-------------------------------------------------------------------------------------------
Inventor 2023 - Dell Precision 5570

Did you find this reply helpful ? If so please use the Accept Solution button below.
Maybe buy me a beer through Venmo @mcgyvr1269
Message 8 of 14
Anonymous
in reply to: Anonymous

Anonymous
Not applicable

What I want to do is the following: 

 

Automate the creation of a specific part. Because it is time consuming to do every time a new part I would like to have a form in which I will input some key values and via iLogic the part will be generated automatically.

 

The problem is that the part is not specific. For example it can start with the extrusion either of a rectangle or a circle. I have solved that problem using iLogic and depending on the option on the form I suppress either the rectangle or the circle.

 

Another problem which I have not solved is the following: There is a sketch inside my part which has a spline. The spline is defined by some points. The points's number is not specific. They user might input 5 or 10 or 200. Therefore I cannot have many sketches created and suppress/activate them. I have to be able to create the points and give them the coordinates that the user inputs.

 

However as I undestood that cannot be done via iLogic

0 Likes

What I want to do is the following: 

 

Automate the creation of a specific part. Because it is time consuming to do every time a new part I would like to have a form in which I will input some key values and via iLogic the part will be generated automatically.

 

The problem is that the part is not specific. For example it can start with the extrusion either of a rectangle or a circle. I have solved that problem using iLogic and depending on the option on the form I suppress either the rectangle or the circle.

 

Another problem which I have not solved is the following: There is a sketch inside my part which has a spline. The spline is defined by some points. The points's number is not specific. They user might input 5 or 10 or 200. Therefore I cannot have many sketches created and suppress/activate them. I have to be able to create the points and give them the coordinates that the user inputs.

 

However as I undestood that cannot be done via iLogic

Message 9 of 14

eugene.morales
Enthusiast
Enthusiast

Hi,

 

I have a part created through a multi body master part and as I create the component into an assembly, I would like to trigger a sketch on the face of a part created once I open the part.

 

Is it possible to trigger the "create sketch" using the iLogic when I open the part file. It is nearly similar to your rule but I like to pick the plane/face of the part in creating the sketch.

0 Likes

Hi,

 

I have a part created through a multi body master part and as I create the component into an assembly, I would like to trigger a sketch on the face of a part created once I open the part.

 

Is it possible to trigger the "create sketch" using the iLogic when I open the part file. It is nearly similar to your rule but I like to pick the plane/face of the part in creating the sketch.

Message 10 of 14

johnsonshiue
Community Manager
Community Manager

Hi Eugene,

 

It may be doable via iLogic. But, you don't actually need to do it in iLogic. Go to Tools -> Application Options -> Part -> Sketch on New Part Creation -> select an origin plane -> Ok.

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer

Hi Eugene,

 

It may be doable via iLogic. But, you don't actually need to do it in iLogic. Go to Tools -> Application Options -> Part -> Sketch on New Part Creation -> select an origin plane -> Ok.

Many thanks!

 



Johnson Shiue (johnson.shiue@autodesk.com)
Software Test Engineer
Message 11 of 14

eugene.morales
Enthusiast
Enthusiast

Hi,

 

Thank you for your reply.

 

This option only works when you're opening a new part template. It doesn't work with part created through a multi-body part.

 

ie. multi-body part --> make component --> target new/existing assembly --> new part created

 

As it opens the target assembly you can now open the parts created. Once open I would like to trigger the iLogic to sketch on a face of the part or prompt me to sketch.

0 Likes

Hi,

 

Thank you for your reply.

 

This option only works when you're opening a new part template. It doesn't work with part created through a multi-body part.

 

ie. multi-body part --> make component --> target new/existing assembly --> new part created

 

As it opens the target assembly you can now open the parts created. Once open I would like to trigger the iLogic to sketch on a face of the part or prompt me to sketch.

Message 12 of 14

Eazyrider_Qc
Contributor
Contributor

Have you been able to resolve your problem?  I'm trying to do something similar...

0 Likes

Have you been able to resolve your problem?  I'm trying to do something similar...

Message 13 of 14

eugene.morales
Enthusiast
Enthusiast

Hi Eazyrider,

 

I haven't got the answer for it yet but I'm still searching for it.

0 Likes

Hi Eazyrider,

 

I haven't got the answer for it yet but I'm still searching for it.

Message 14 of 14
rhasell
in reply to: eugene.morales

rhasell
Advisor
Advisor

Hi

 

Have you considered iFeatures?

These can be ultimately be driven via forms and iLogic?

I use them a lot for start parts, they save me heaps of time.

Setup and design can be a learning experience and sometimes a PITA, takes me a while to get them just right.

 

Reg
2025.1.2
Please Accept as a solution / Kudos
0 Likes

Hi

 

Have you considered iFeatures?

These can be ultimately be driven via forms and iLogic?

I use them a lot for start parts, they save me heaps of time.

Setup and design can be a learning experience and sometimes a PITA, takes me a while to get them just right.

 

Reg
2025.1.2
Please Accept as a solution / Kudos

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

Post to forums  

Autodesk Design & Make Report