Find position of workpoint in flat pattern that was created in the folded model

Find position of workpoint in flat pattern that was created in the folded model

johnPGNFG
Enthusiast Enthusiast
525 Views
5 Replies
Message 1 of 6

Find position of workpoint in flat pattern that was created in the folded model

johnPGNFG
Enthusiast
Enthusiast

I'm exporting sheet metal parts as flat patterns using the api.  I have no problem unfolding the part and finding all the operations (holes, slots, outter edges, etc) but I need to export the position of text on the part as well.  The problem is text doesn't show up in the flat pattern and it appears Inventor doesn't attempt to figure out where the text would land in the flat pattern.  From my research, only brep objects are transferred to the flat pattern.  The method FlatPattern.GetFlatPatternEntity() seemed promising at first.  I converted the text origin into a 3d point and and input that into the method with no luck.  I tried creating a workpoint at the text origin and that didn't work either. Both returned null.  Is there something I'm missing?  It doesn't make sense to me that I can input an edge,  GetFlatPatternEntity(edge), and get back the edge in the flat pattern along with the position of it's end points but I can't ask where a specific point on a face will end up in the flat pattern.  

 

foreach (Inventor.TextBox text in sketch.TextBoxes)
{
Inventor.Point2d textOrigin = text.Origin;

PlanarSketch pSketch = (PlanarSketch)sketch;

Inventor.Point2d textOriginCopy = textOrigin.Copy();

Inventor.Point textOrigin3d = pSketch.SketchToModelSpace(textOriginCopy);

Inventor.Point textOrigin3dcopy = textOrigin3d.Copy();

WorkPoint textOrigin3dwork = partDoc.ComponentDefinition.WorkPoints.AddFixed(textOrigin3dcopy);

 

object flatPoint1 = (object)sheetdef.FlatPattern.GetFlatPatternEntity(textOrigin3dcopy);  //returns null

object flatPoint2 = (object)sheetdef.FlatPattern.GetFlatPatternEntity(textOrigin3dwork); //returns null

}

 

johnPGNFG_0-1687281713751.png

 

0 Likes
Accepted solutions (1)
526 Views
5 Replies
Replies (5)
Message 2 of 6

JelteDeJong
Mentor
Mentor

I wanted to do something similar but I never found a good solution. If I need to find a point both in the flatpattern and the folded model then I make a very small hole in the folded model at the point that I need to find. Then I look op that hole in the flatpattern. (If anyone knows a better solution I would like to know about it.) But I see that you want text. If you are working with Inventor 2023 or newer that you have a special command for this. Have a look at the Mark command.

https://help.autodesk.com/view/INVNTOR/2023/ENU/?guid=GUID-8B8DD53E-2E54-43D4-8E7B-7B90CAEB4BFA

It has some interesting extra options.

Jelte de Jong
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.

EESignature


Blog: hjalte.nl - github.com

0 Likes
Message 3 of 6

johnPGNFG
Enthusiast
Enthusiast

Creating a small hole was my next idea but that seems like such a goofy way to go about this.  The software I am writing will be used by customers so there's no guarantee they will have 2023 but it's good to know that is an option now! I'll play around with it, thanks for the help.

0 Likes
Message 4 of 6

Frederick_Law
Mentor
Mentor

Cut/Emboss the text on the model.

0 Likes
Message 5 of 6

Michael.Navara
Advisor
Advisor
Accepted solution

This is very easy job. 😀

Sketch in sheetmetal part has option PlanarSketch.CopyToFlatPattern Property 

This can be set manually or using API.

MichaelNavara_0-1687346512511.png

 

 

2023-06-21_13-23-00.jpg

 

 

 

 

Message 6 of 6

johnPGNFG
Enthusiast
Enthusiast

Bingo! Thank you, that makes life way easier

0 Likes