HELP MACRO

HELP MACRO

XsR_L
Explorer Explorer
694 Views
4 Replies
Message 1 of 5

HELP MACRO

XsR_L
Explorer
Explorer

Hello everyone, have a nice day,
I have a problem to solve,

Change toolpath segment start and end values
I tried many ways but couldn't solve it so please help me solve this problem

Thanks in advance..

Take care and have a nice day!

 

 


int c=toolpath_component_count(toolpath, 'segments')
FORM TPLIST
int RR=$C
STRING LIST TPList=extract(folder('toolpath'),'name')
STRING ActiTH=basename(pathname('Toolpath',name))
Bool swapped = 1
INT Idx=0
INT i1=SIZE(TPList)
IF ActiTH!="" {
WHILE i1>0 AND swapped {
$swapped=0
IF TPList[Idx]==ActiTH {
$swapped=0
$Idx=Idx+1
IF Idx==i1 {
ACTIVATE TOOLPATH $TPList[0]
} ELSE {
ACTIVATE TOOLPATH $TPList[Idx]
}
} ELSE {
$swapped=1
}
$Idx=Idx+1
}
} ELSE {
ACTIVATE TOOLPATH $TPList[0]
}

FORM TPLIST
EDIT TPSELECT ; TPLIST UPDATE
0 NEW
int i=1
while i<RR {
EDIT TPSELECT ; TPLIST UPDATE
$i TOGGLE
$i=i+1
}
TPLIST ACCEPT
DIALOGS MESSAGE ON
DIALOGS ERROR ON

 

 

Version 2016

0 Likes
695 Views
4 Replies
Replies (4)
Message 2 of 5

icse
Advisor
Advisor

I dont get it,

how do you whant the toolpath to be reordered?

0 Likes
Message 3 of 5

XsR_L
Explorer
Explorer

Select the tool path in advance as a reference

0 Likes
Message 4 of 5

icse
Advisor
Advisor

i still dont get it...

Do you try to invert the current selection?

Wich toolpaths you want to select?

can you add some screenshots(before/after)

0 Likes
Message 5 of 5

icse
Advisor
Advisor

Does this work for you?

 

entity $tpA = input entity toolpath 'Select Toolpath A'
if $tpA.Computed == 0 {
	return
}

entity $tpB = input entity toolpath 'Select Toolpath B'
if $tpB.Computed == 0 {
	return
}

activate toolpath ${tpA.Name}
FORM TPLIST

int $segmentIndex = segments($tpA)

string list $startAndEndPoint = {}

while $segmentIndex > 0 {	
	$segmentIndex = $segmentIndex - 1
	
	int $i = add_last($startAndEndPoint, list_cell_value('TPList.TPListView', $segmentIndex, 1)+list_cell_value('TPList.TPListView', $segmentIndex, 2))
} 


activate toolpath ${tpB.Name}
$segmentIndex = segments($tpB)


while $segmentIndex > 0 {	
	$segmentIndex = $segmentIndex - 1
	
	if member($startAndEndPoint,list_cell_value('TPList.TPListView', $segmentIndex, 1)+list_cell_value('TPList.TPListView', $segmentIndex, 2)) {
		EDIT TPSELECT ; TPLIST UPDATE\r ${segmentIndex} TOGGLE
	}
} 
0 Likes