How do I select a segment of a Pattern

How do I select a segment of a Pattern

per.soerensen2EV6F
Advocate Advocate
1,042 Views
3 Replies
Message 1 of 4

How do I select a segment of a Pattern

per.soerensen2EV6F
Advocate
Advocate

For Boundaries I can use this, if I need to check individual segments.

INT SegNum = segments(Boundary)
IF $SegNum <=1 {
RETURN
}
INT Seg = $SegNum-1

DO {
EDIT BOUNDARY ; DESELECT ALL
EDIT BOUNDARY ; SELECT $Seg

 

}

 

But this do not work for Patterns even though the "PM-Macro-Programming-Guide" says so on page 101.

 

Do any one have a solution?

 

0 Likes
Accepted solutions (2)
1,043 Views
3 Replies
Replies (3)
Message 2 of 4

rafael.sansao
Advisor
Advisor
Accepted solution
INT SegNum = segments(entity("Pattern",""))

Rafael Sansão

OptiNC - www.optinc.tech

EESignature

0 Likes
Message 3 of 4

urizenYHS3W
Advocate
Advocate
Accepted solution

The command EDIT BOUNDARY ; will reference the active Boundary. However, unlike Boundaries, Patterns do not automatically activate when the toolpath is activated. So you have to activate them yourself ACTIVATE Pattern $Pattern, or whatever. After that you'll find that segments(Pattern) and EDIT PATTERN ; will work the same as Boundary.

0 Likes
Message 4 of 4

per.soerensen2EV6F
Advocate
Advocate

// ExportTool Export Directory
STRING $ExportToolTempDir = "C:\Temp\Probe"
MKDIR $ExportToolTempDir
//
//
// Definition CSV-fil
STRING $Line=''
STRING $File=$ExportToolTempDir+'/'+$NC_Name+'.csv'
// Creade bat file path
FILE OPEN $File FOR WRITE AS outputfile
$Line = 'X' +' ; '+ 'Y'+' ; '+ 'Z'
FILE WRITE $Line TO outputfile
//
STRING $Pat = $entity('pattern','').name
INT SegNum = segments(entity("pattern",""))
IF $SegNum <=1 {
RETURN
}
INT Seg = $SegNum-1
DO {
EDIT PATTERN ; DESELECT ALL
EDIT PATTERN ; SELECT $Seg
COPY PATTERN ; SELECTED
ACTIVATE Pattern #
// Set limet variabels
REAL LIST $Limits = LIMITS($entity('pattern',''))
// Xmin = 0 // Xmax = 1 // Ymin = 2 // Ymax = 3 // Zmin = 4 // Zmax = 5
REAL PX = round($Limits[0];3)
REAL PY = round($Limits[2];3)
REAL PZ = round($Limits[4];3)
Print = $PX
Print = $PY
Print = $PZ
$Line = $PX +' ; '+ $PY +' ; '+ $PZ
FILE WRITE $Line TO outputfile
DELETE PATTERN ;
ACTIVATE Pattern $Pat
//
$Seg = $Seg-1
} WHILE $Seg >=0
FILE CLOSE outputfile

0 Likes