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: 

Determine if Marks are on the A-side

3 REPLIES 3
Reply
Message 1 of 4
jzarczynski
109 Views, 3 Replies

Determine if Marks are on the A-side

Hi,

Due to our manufacturing process, we need to ensure that all marks created on a part are on the A-side of the sheet metal flat pattern.

 

My concept was to detect the A-side face and the face where the mark was created.

 

 

If markFeatures.Count > 0 Then
        If sheetMetalComp.FlatPattern IsNot Nothing Then
            Dim flatPattern As FlatPattern = sheetMetalComp.FlatPattern

            If flatPattern.ASideFace IsNot Nothing Then
                Dim asideDef As ASideDefinition = flatPattern.ASideFace
                Dim asideFace As Face = asideDef.ASideFace
                Dim marksOnASide As Integer = 0
               
                For Each markFeature As MarkFeature In markFeatures
                     ' There so property in Markfeature i can Use
                    Dim markFace As Face = MarkFeature.
                    If asideFace.EntityName = markFace.EntityName Then
                        marksOnASide += 1
                    End If
                Next

 

 

However, when reviewing MarkFeature properties, I do not see anything I can use to detect this:

 

https://help.autodesk.com/view/INVNTOR/2025/ENU/?guid=GUID-MarkFeature

 

Could you advise if there is any possible approach to overcome this issue?

 

3 REPLIES 3
Message 2 of 4
R.Mabery
in reply to: jzarczynski

Hi @jzarczynski,

 

Have you looked at the FindUsingRay method?  You should be able to get the face that the Mark Feature is on this way and determine if that's the A Side face.  

 

FYI, I haven't worked this out in code yet..... but the FindUsingRay method works well.


Thanks,
Randy Mabery
Applications Expert
IMAGINiT Technologies
Message 3 of 4
nstevelmans
in reply to: jzarczynski

Hi, maybe you can try this I do check on the TransientKey.

  1. make list of all TransientKey from the flatpattern
  2.  make a list of all transientKey from the markFeature.
  3. Then do a compare.
 Dim oDoc As Document = ThisApplication.ActiveDocument
        Dim oAsideFaces As New List(Of Long)
        Dim oMarkFaces As New List(Of Long)
        If oDoc IsNot Nothing Then
            If oDoc.DocumentType = DocumentTypeEnum.kPartDocumentObject Then
                Dim oPartDoc As PartDocument = oDoc
                If oPartDoc.ComponentDefinition.Type = ObjectTypeEnum.kSheetMetalComponentDefinitionObject Then
                    Dim oSheetMetalCompDef As SheetMetalComponentDefinition = oPartDoc.ComponentDefinition
                    Dim oFlattPatternExist As Boolean = oSheetMetalCompDef.HasFlatPattern
                    If oFlattPatternExist = True Then
                        Dim oFlatPattern As FlatPattern = oSheetMetalCompDef.FlatPattern
                        Dim oAsideFace As ASideDefinition = oFlatPattern.ASideFace
                        Dim oFace As Face = Nothing
                        For Each oFace In oAsideFace.Faces
                            oAsideFaces.Add(oFace.TransientKey)
                        Next
                        Dim oFeatures As SheetMetalFeatures = oSheetMetalCompDef.Features
                        Dim oMarkFeature As MarkFeature = Nothing
                        For Each oMarkFeature In oSheetMetalCompDef.Features.MarkFeatures
                            For Each oFace In oMarkFeature.Faces
                                oMarkFaces.Add(oFace.TransientKey)
                                Dim commonNames = oAsideFaces.Intersect(oMarkFaces).ToArray()
                                If commonNames.Length = 0 Then
                                    MsgBox("Ckeck your part")
									exit sub
                                End If
                            Next
                        Next
                    End If
                End If
            End If
        End If

 

If a response answers your question, please use  ACCEPT SOLUTION  to assist other users later.

 

Also be generous with Likes!  Thank you and enjoy!

 

Message 4 of 4
rlutesD2P6K
in reply to: jzarczynski

I ended up solving this exact problem a couple months ago.

 

Below is a snippet of a much larger, complex laser checker code. You'll have to ignore some of the custom stuff going on, but this functions well. I haven't heard of any false positives or negatives since this was implemented.

 

We have two styles, a "etch" and a "through" cut, so we need to check for that. (through cuts can be on either side without a problem) You will need to check both the folded and flat patterns to be thorough, as designers can screw that up separately.

 

 

			'check if etch is on wrong side in folded model
			Try
			If tPart.Def.features.markfeatures.count > 0 Then 'if mark exists
				For Each tfeature In tPart.Def.features.markfeatures 'for each mark feature in folded model
					TDef = Tfeature.Definition 'get details of the mark feature
					Tstyle = TDef.markgeometrysetitem(1).style 'find which style its using
					If Tstyle.name = "Mark Surface" 'we only care if its a mark surface - etch
						Tgeom = TDef.markgeometrysetitem(1).geometries 'get geometry that generates it
						MarkSketch = tgeom(1).parent 'get sketch that creates geometry
						Try
						MarkFace = MarkSketch.planarentity 'get the face the mark works on
						flattenFace = oFP.getflatpatternentity(MarkFace) 'convert it to the flat pattern equivelent
						If flattenFace Is oFP.bottomface Then 'if the flat pattern equivelent is the bottom face of the flat pattern
							If ErrorAndOpen(tPart.Path,"has etches on the wrong side!") Then
							LaserChecker = True
							Exit Function
							End If
						End If
						Catch
							If ErrorAndOpen(tPart.Path,"has etches that aren't on the part!") Then
							LaserChecker = True
							Exit Function
							End If
						End Try
				End If
				Next
			End If	
			'check if etch is on wrong side in flat pattern
			If oFP.FEATURES.markfeatures.COUNT > 0 Then
				For Each Tfeature In oFP.FEATURES.markfeatures
					TDef = Tfeature.Definition
					Tstyle = TDef.markgeometrysetitem(1).style
					If Tstyle.name = "Mark Surface"
						Tgeom = TDef.markgeometrysetitem(1).geometries
						MarkSketch = tgeom(1).parent
						flattenface = MarkSketch.planarentity 'same as above, but skip the flat pattern equivelent step
						If flattenFace Is oFP.bottomface Then
							If errorandopen(tPart.Path,"has etches On the wrong side!") Then
								LaserChecker = True
								Exit Function
							End If
						End If
					End If
				Next
			End If

 

 

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report