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 and Construction mode

10 REPLIES 10
Reply
Message 1 of 11
llorden4
547 Views, 10 Replies

iLogic and Construction mode

I haven't noticed this before so I don't know if this is a new bug in Inventor 2022.1 or just something I never came across before.

 

When manually creating a new sketch,  construction mode is NOT active.

If I exit a sketch in construction mode and then return to edit the sketch manually, construction mode is NOT active.

 

I am discovering today that if I leave a sketch manually with construction mode still active, then any sketches created by iLogic/API have all objects in Constructive mode.  If I manually go into the sketch created by automation with these objects in construction mode, then construction mode is NOT active.

 

So has this always been the case and I need to go back through all my iLogic programs and ensure that each object I create is assigned a mode (in case someone left a sketch previously with construction mode still on) or is this a new bug/issue?  I've been under the assumption that objects are not in construction mode unless I toggle them to that mode.  If this has always been the case, then I've just been very lucky thus far not to have a failure in an iLogic build.

 

Autodesk Inventor Certified Professional
10 REPLIES 10
Message 2 of 11
ravikmb5
in reply to: llorden4

no,

not true

working fine here

Please mark this response as Problem Solved if it answers your question.
----------------------------------------------------------------------------------------------
Ravi Kumar MB,
i7 860 Dell Studio XPS Win 7 64 bit 12 Gb RAM & HP Z220 SFF Workstation
Autodesk Inventor Certified professional 2016
Email: ravikmb5@gmail.com





Message 3 of 11
llorden4
in reply to: ravikmb5

Attaching video evidence

Autodesk Inventor Certified Professional
Message 4 of 11
J-Camper
in reply to: llorden4

What is that iLogic rule doing?  Does it change the Construction Property of the sketch lines?

Message 5 of 11
llorden4
in reply to: J-Camper

Here's the code, nothing calling for the construction mode

oWorkPlane = oCompDef.WorkPlanes.Item("DXF Plane")
oSketch = oCompDef.Sketches.Add(oWorkPlane)
 oSketch.Name = "Core Sketch"
oGC = oSketch.GeometricConstraints
oDC = oSketch.DimensionConstraints
oCP = oSketch.AddByProjectingEntity(oCompDef.WorkPoints.Item(1))
oHorz = oSketch.SketchLines.AddByTwoPoints(oCP, oTG.CreatePoint2d(TopRad, 0))
oGC.AddGround(oHorz.EndSketchPoint)
oTPoly = oSketch.SketchLines.AddAsPolygon(NoSides, oCP, oTG.CreatePoint2d(0, TopRad * 2.54), False)
oGC.AddHorizontal(oTPoly.Item(NoSides))
oTmp = oDC.AddOffset(oTPoly.Item(NoSides), oCP, oTG.CreatePoint2d(1, TopRad / 2 * 2.54), False, False)
oTmp.Parameter.Value = TopRad * 2.54
oTmp = oDC.AddOffset(oTPoly.Item(NoSides / 4), oCP, oTG.CreatePoint2d(TopRad / 2 * 2.54, 1), False, False)
oTmp.Parameter.Value = TopRad * 2.54
oTmp = oDC.AddOffset(oTPoly.Item(NoSides), oTPoly.Item(NoSides / 2), oTG.CreatePoint2d(-1, 0), False, False)
oTmp = TopRad * 2 * 2.54
oBPoly = oSketch.SketchLines.AddAsPolygon(NoSides, oCP, oTG.CreatePoint2d(0, BotRad * 2.54), False)
oGC.AddHorizontal(oBPoly.Item(NoSides))
oTmp = oDC.AddOffset(oBPoly.Item(NoSides), oCP, oTG.CreatePoint2d(1, BotRad / 2 * 2.54), False, False)
oTmp.Parameter.Value = BotRad * 2.54
oTmp = oDC.AddOffset(oBPoly.Item(NoSides / 4), oCP, oTG.CreatePoint2d(BotRad / 2 * 2.54, 1), False, False)
oTmp.Parameter.Value = BotRad * 2.54
oTmp = oDC.AddOffset(oBPoly.Item(NoSides), oBPoly.Item(NoSides / 2), oTG.CreatePoint2d(-1, 0), False, False)
oTmp = BotRad * 2 * 2.54

 

Autodesk Inventor Certified Professional
Message 6 of 11
J-Camper
in reply to: llorden4

Is that the exact rule in your part?  When I try to test, it is missing API objects and creates a new sketch every time the rule runs, which is not the behavior seen in your video.

 

Anyways, I've noticed this behavior in the past, different users having different Sketch formatting options activated [construction, centerpoint, centerline, ...] means the lines created get made by whatever option is set in their environment.  I have always made it a point to set my API created sketchEntities to whatever type of line/point format I want it to be so the rule functions as intended for all end users.

 

You might want to add this to your rule to ensure the created geometry has the formatting you intend.

Message 7 of 11
llorden4
in reply to: J-Camper

I've stripped out proprietary coding, attached is the actual file with all the declarations and API objects.

 

It does kill/wipe any previous sketches and starts anew with each run.

Autodesk Inventor Certified Professional
Message 8 of 11
llorden4
in reply to: J-Camper

"Anyways, I've noticed this behavior in the past, different users having different Sketch formatting options activated [construction, centerpoint, centerline, ...] means the lines created get made by whatever option is set in their environment.  I have always made it a point to set my API created sketchEntities to whatever type of line/point format I want it to be so the rule functions as intended for all end users."

 

That's what I was thinking I might need to do as I'm doing with Inferred constraints.   Can you share that bit of iLogic, I'm not able to dig up that line of API coding.

Autodesk Inventor Certified Professional
Message 9 of 11
J-Camper
in reply to: llorden4

Here is a snippet of one of my ilogic rules where I create a rectangle that is meant to be construction.  You will want to do something similar anytime you create geometry:

'Create rectangle
	Dim oRecLines As SketchEntitiesEnumerator = s.Sketchlines.AddAsTwoPointRectangle(CornerPointOne, CornerPointTwo)
	For Each l As SketchLine In oRecLines
		l.Construction = True 'False for non-construction lines
	Next

I just run a short For Loop to set the Construction status of my lines from the EntitiesEnumerator after creating geometry. 

Message 10 of 11
llorden4
in reply to: J-Camper

I've got changing the mode after creation, I thought you were leading me to a document setting to ensure user changes weren't made from factory defaults for Sketch mode line types.  I was curious where that setting was as I wasn't able to dig it up.

 

[quote


@J-Camper wrote:
"Anyways, I've noticed this behavior in the past, different users having different Sketch formatting options activated [construction, centerpoint, centerline, ...] means the lines created get made by whatever option is set in their environment.  I have always made it a point to set my API created sketchEntities to whatever type of line/point format I want it to be so the rule functions as intended for all end users. You might want to add this to your rule to ensure the created geometry has the formatting you intend."
Autodesk Inventor Certified Professional
Message 11 of 11
J-Camper
in reply to: llorden4

Yeah I thought this was the property when I looked awhile ago, but it does not change the sketch lines format.  I then looked for a similar property in SketchOptions Object, but there was nothing that look right.

 

I finally settled on setting my format after creation, as detailed above.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report