Redefining sketch/features with ilogic

Redefining sketch/features with ilogic

Anonymous
Not applicable
1,763 Views
7 Replies
Message 1 of 8

Redefining sketch/features with ilogic

Anonymous
Not applicable

I'm having trouble redefining features with ilogic.

What I am trying to do is change the face holes appear on deppending on a selection the user makes.

 

so far I've named the faces within the model and have not managed to get it working.

 

Where am I going wrong?

I've attached the code below.

 

Thanks for your time.

ilogic code:

------------------------------------

SyntaxEditor Code Snippet

'Outlet types

'DXT1 Standard
'DXT3 Outlet on back face

Select Case Outlet_Position
Case DXT1
	Sketch.Redefine(Sketch30, DXT1, DXT1, DXT1, DXT1)
	Sketch.Redefine(Sketch29, DXT1, DXT1, DXT1, DXT1)
	
Case DXT3
	Sketch.Redefine(Sketch30, DXT3, DXT3, DXT3, DXT3)
	Sketch.Redefine(Sketch29, DXT3, DXT3, DXT3, DXT3)
	
End Select

InventorVb.DocumentUpdate()

 

0 Likes
Accepted solutions (1)
1,764 Views
7 Replies
Replies (7)
Message 2 of 8

philip1009
Advisor
Advisor

I don't think it's possible to redefine the sketch to another plane via code, I don't see a redefine method for sketches in either the API or in the iLogic snippets.  Would you mind sharing where you got the code from?  What I would do is redefine the sketch to a work-plane, then you can use code to move that work-plane wherever you need it.

Message 3 of 8

Anonymous
Not applicable
Thanks for the reply, would this effect the feature (holes) or patterns?
How about iMates?
How can I move a plane to another face via illogic?
I got the code from:
https://knowledge.autodesk.com/support/inventor-products/learn-explore/caas/CloudHelp/cloudhelp/2014...
Thank you!
0 Likes
Message 4 of 8

philip1009
Advisor
Advisor
Accepted solution

Okay, that's really strange how the knowledge forums have functions that are not in the API guide.  @johnsonshiue, can you or someone else at Autodesk explain what's going on?  The only explanation I can think of is if this was a function in the API in at least 2014 Inventor that's since been removed or replaced by something else.

 

As for affecting the holes, as long as they're still going through the same bodies previously defined before moving, they should still work just the same as redefining the sketch, you're basically just moving the starting position of the holes.

 

As for iMates, I'm not sure, I don't work with iMates very much, but I think as long as it's the same geometry generated by the same work feature going through the same Body, Inventor should be able to follow the move.

 

For moving the work plane around via code, the API guide lists plenty of methods for redefining the work plane in a part document, my idea is to just always have the plane defined to other set work features, i.e. have a work plane attached to each possible face, then redefine the sketch plane to whichever face plane you want:

API Help_edited.jpgworkplane_edited.jpg

 

Another possible solution, depending on how many locations of holes you have to set up, is to have code to suppress and un-suppress features in parts and suppress/un-suppress constraints in the related assemblies.

 

Message 5 of 8

Anonymous
Not applicable

Thanks again!

 

I was thinking about using the supress and unspress features, but I've got so many rules driving the hole locations and numbers that I just thought it would be easier to move the sketch and feature to the required face, but I suppose this might not work because the dimensions would not carry over into positions that I require.

0 Likes
Message 6 of 8

chandra.shekar.g
Autodesk Support
Autodesk Support

@Anonymous,

 

Sketch can be redefined in another approach. Hoping that suggestion in below forum discussion would be helpful.

 

https://forums.autodesk.com/t5/inventor-customization/ilogic-sketch-redefine/m-p/8211040#M87883

 

Thanks and regards,


CHANDRA SHEKAR G
Developer Advocate
Autodesk Developer Network



0 Likes
Message 7 of 8

BrianEkins
Mentor
Mentor

The Redefine method is an iLogic specific function and is just wrapping the existing API functionality provided by the PlanarSketch object.  All sketches in a part are represented by a PlanarSketch object.  A PlanarSketch provides all of the functionality of the Sketch object but also provided additional functionality because it represents a 2D sketch in a 3D space and has the functionality to position it in 3D space and get information about how its 2D space correlates to 3D space.

The functionality on the PlanarSketch object you might be interested in are the PlanarEntity, OriginPoint, AxisEntity, and NaturalAxisDirection properties.  All of those are read-write properties and can be set to change the position and orientation of the sketch. 

---------------------------------------------------------------
Brian Ekins
Inventor and Fusion 360 API Expert
Website/Blog: https://EkinsSolutions.com
Message 8 of 8

philip1009
Advisor
Advisor

It would make sense that's it's an iLogic function or a snippet, but the problem is I'm not seeing it in the iLogic snippets section of the rule editor.  Where is this function and possibly other hidden functions documented so they can be learned and used?