iLogic Detect if Emboss is on Base Face (A-Side)

iLogic Detect if Emboss is on Base Face (A-Side)

zdesigns
Participant Participant
756 Views
6 Replies
Message 1 of 7

iLogic Detect if Emboss is on Base Face (A-Side)

zdesigns
Participant
Participant

Can someone please provide some insight on how to find out using iLogic if an Emboss feature done on Sheet Metal part is on the Base Face of the flat pattern, or if it is on the Back side? What happens is that text is embossed on a sheet metal part and then a flat pattern is produces and a DXF is saved using iLogic. This works fine. What often happens is the person modelling the part often doesn't define the A-Side correctly and the embossed text appears on the back side of the flat pattern. I need a way to detect if the Base Face needs to be flipped or not.

 

Thank you

0 Likes
Accepted solutions (1)
757 Views
6 Replies
Replies (6)
Message 2 of 7

Michael.Navara
Advisor
Advisor
Accepted solution

This is a sample, how to detect it and print result to the console. At least one emboss feature must exists and only the first emboss feature is checked. You need to modify the code to your needs.

Dim part As PartDocument = ThisDoc.Document
Dim partDef As SheetMetalComponentDefinition = part.ComponentDefinition
Dim emboss1 As EmbossFeature = partDef.Features.EmbossFeatures(1)
Dim flatPattern As FlatPattern = partDef.FlatPattern

'Get source face of Emboss feature
Dim embossSketch As PlanarSketch = emboss1.Profile.Parent
Dim embossFace As Face = embossSketch.PlanarEntity

'Get corresponding entity in FlatPattern
Dim flattenFace = flatPattern.GetFlatPatternEntity(embossFace)

'Print result
If flattenFace Is flatPattern.TopFace Then
	Logger.Debug("On TopFace")
ElseIf flattenFace Is flatPattern.BottomFace Then
	Logger.Debug("On BottomFace")
Else
	Logger.Debug("Not found")
End If

 

Message 3 of 7

zdesigns
Participant
Participant

@Michael.Navara This sample is conceptually exactly what was asked. There should be no issue in modifying the provided code to fit my specific case. My programming skills are quite proficient, but I am fairly new to iLogic and its API. This was a big time saver. I really appreciate it. Thank you for the quick reply!

0 Likes
Message 4 of 7

zdesigns
Participant
Participant

@Michael.Navara I have a followup to the above sample code, specifically what determines that a face is "Not found", even though the part is correctly designed with the embossing being either on the TopFace or BottomFace?

 

I wrote some code to test this on over a hundred  existing parts and 40% of the time the face was not found. To investigate this further, I created a new part that should correctly identify the TopFace, but instead it shows that it is "Not found". However, after saving and reopening the part it correctly detects the TopFace. Furthermore, if the geometry of the part changes in any way it is "Not found" again. Then, with the process of saving and reopening the part it correctly detects the TopFace.

 

0 Likes
Message 5 of 7

WCrihfield
Mentor
Mentor

I have heard similar feedback from a couple other forum users before.  It seems like sometimes, depending on what we are doing, we often need to make sure the part is fully updated before attempting to do certain things with the FlatPattern object.  In some of my previous attempts to help others with FlatPattern issues by code, the 'TopFace' property could not be used, because it seemed like it did not contain a valid Face, but it seemed like the 'BottomFace' or 'BaseFace' were more stable to use.  The BaseFace can be specified manually, when you initially create the FlatPattern, but specifying it is optional, and gets one gets selected automatically, if we do not manually pick one, so it should have a Value.  Maybe try using Document.Update2(True) or Document.Rebuild2(True) before accessing the FlatPattern, or maybe enter into its Edit Mode before the check, then return to folded mode, even though that may be more costly to process.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 6 of 7

zdesigns
Participant
Participant

@WCrihfield Thank you for the input. I was leaning towards Rebuild/Update, but none of these options worked other than saving and reopening the part. This led me to test further and select the flattenFace and this is where I noticed what was happening. 

 

If we open the part and test for the flattenFace it correctly identifies the TopFace:

flat-A2.png

 

Then, if we edit the part and test again, the flattenFace becomes as follows which is "not" the TopFace:

flat-A1.png

 

Using a simpler letter "I" confirms this and the correct TopFace is identified every single time, no matter how we edit the part.

flat-I.png

 

Knowing this, I am curious as to what is the best solution, if there are multiple faces as in the first case?

Message 7 of 7

zdesigns
Participant
Participant

Just wanted to inform on the solution I implemented in order to close this out. The idea is to find all co-planer faces to the Emboss face and check it against TopFace/BottomFace. This seems to be the most straight forward approach.

0 Likes