[MACRO] Polyworks Looping

Discuss PolyWorks here.
Post Reply
User avatar
TK.421
I have made <0 posts
I have made <0 posts
Posts: 2
Joined: Wed Aug 22, 2018 7:54 pm
Full Name: David Adam
Company Details: Accurate Pattern
Company Position Title: peon
Country: US
Linkedin Profile: No

[MACRO] Polyworks Looping

Post by TK.421 » Wed Aug 22, 2018 11:14 pm

Due to a lack of a user forum on Innovmetric's website, I'm hoping this user forum is frequented often!

I have a bunch of comparison points divided up into a number of groups. I have all my groups in a list. I'm not familiar with the syntax of the poylworks macro language though. I've looked through the macro commands help and I cant find what I'm looking for. I dont see any available commands to do a FOR EACH loop. How would I go about looping through each group of comparison points? The end game is changing the name of the first item in each group along with some of the geometric controls.

Here's what I have so far:

Code: Select all

DECLARE numOfGrps 
DECLARE grpName  
DECLARE itmName
DECLARE i 1


TREEVIEW OBJECT_ELEMENTS SELECT NONE

TREEVIEW OBJECT_GROUP COUNT GET ( numOfGrps )
TREEVIEW OBJECT_GROUP NAME ALL GET ( grpName )

WHILE $i <= $numOfGrps 
    
    ### this is where I want to get the 1st item name of each group to variable $itmName ###
    
    MACRO PAUSE ( $grpName[$i] )  # returns group name
    
    ++i    
ENDWHILE
Thanks in advance!

User avatar
TK.421
I have made <0 posts
I have made <0 posts
Posts: 2
Joined: Wed Aug 22, 2018 7:54 pm
Full Name: David Adam
Company Details: Accurate Pattern
Company Position Title: peon
Country: US
Linkedin Profile: No

Re: [MACRO] Polyworks Looping

Post by TK.421 » Thu Aug 23, 2018 5:14 pm

So here's the way to do it if anyone ever runs into this particular problem:

Code: Select all

DECLARE count
DECLARE name
DECLARE itemName
DECLARE i 1

TREEVIEW OBJECT_GROUP COUNT GET ( count )
TREEVIEW OBJECT_GROUP NAME ALL GET ( name )


while $i <= $count
    TREEVIEW OBJECT SELECT NONE
    TREEVIEW OBJECT_GROUP SELECT ($name[$i])

    TREEVIEW COMPARISON_POINT NAME SELECTED GET ( itemName )
    TREEVIEW OBJECT SELECT NONE
    TREEVIEW OBJECT SELECT ("$itemName[1]")
    
    MACRO PAUSE ( "$itemName[1]" ) #used as a print command to check results
    
    ++ i
ENDWHILE
Last edited by TK.421 on Thu Aug 23, 2018 9:07 pm, edited 1 time in total.

User avatar
Jason Warren
Administrator
Administrator
Posts: 3018
Joined: Thu Aug 16, 2007 9:21 am
Full Name: Jason Warren
Company Details: Laser Scanning Forum Ltd
Company Position Title: Co-Founder
Country: UK
Skype Name: jason_warren
Linkedin Profile: Yes
Location: Retford, UK
Contact:

Re: [MACRO] Polyworks Looping

Post by Jason Warren » Thu Aug 23, 2018 5:39 pm

Nice one, thank you for posting ... ;)
Jason Warren

cwxTools
http://www.cwxtools.com

High Definition Surveys Ltd
http://www.highdefinitionsurveys.co.uk

User avatar
NOVAMECH
V.I.P Member
V.I.P Member
Posts: 231
Joined: Wed Aug 04, 2010 5:43 am
Full Name: Nick Bush
Company Details: NOVAMECH
Company Position Title: Director
Country: New Zealand
Skype Name: novamech5
Linkedin Profile: Yes
Location: Auckland, New Zealand
Contact:

Re: [MACRO] Polyworks Looping

Post by NOVAMECH » Wed Nov 28, 2018 8:34 pm

Thanks, for Posting on the POLYWORKS Tab. We need more. I was just trying out the MACRO function yesterday

Post Reply

Return to “PolyWorks”