Announcements
Due to scheduled maintenance, the Autodesk Community will be inaccessible from 10:00PM PDT on Oct 16th for approximately 1 hour. We appreciate your patience during this time.
Community
PowerMill Forum
Welcome to Autodesk’s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Help with error in macro

1 REPLY 1
SOLVED
Reply
Message 1 of 2
jedQB94J
879 Views, 1 Reply

Help with error in macro

Hi,

 

Why got I this message, and how can I solved it?

 

ERROR.png

 

Function Main() {

// User customisable section ----------------------------------------------
// Split the part in colores and acquire them in each "sets"

STRING $CHUCK = "229,31,31" //CHUCK
STRING $STOCK = "244,244,244" //STOCK
STRING $ROTOR = "191,191,191" //ROTOR
STRING $SHROUD = ""
STRING $HUB = ""
STRING $LEFT = ""
STRING $RIGHT = ""
//STRING $GREEN = "13,157,13"
//STRING $GREY = "105,105,105" //COLOR FROM INVENTOR IS "STEEL"
//STRING $YELLOW = "221,221,13" //TAPPED HOLES BLIND
//STRING $BLUE = "24,37,248" //TAPPED HOLES THROUGH
//STRING $Selected_Model

// Define the SET names of each group of surfaces. This is added for those who want the names in a different language or terminology..
// If you add any additional colors, create a STRING variable for it above
// and add it to the RGB_Values LIST below
STRING LIST $Set_Names = {'CHUCK', 'STOCK', 'ROTOR', 'SHROUD', 'HUB', 'LEFT', 'RIGHT'}

// Define the corresponding RGB values for the above Set_Names list. Make
// sure there is a 1 to 1 relationship between this list and the one above,
// otherwise the macro will break.
// I used the above variables to make it more readable.
STRING LIST $RGB_Values = {$CHUCK, $STOCK, $ROTOR, $SHROUD, $HUB, $LEFT, $RIGHT}

// ------------------------------------------------------------------------
// ------------------------------------------------------------------------
// Create a series of new SETS to place the colored surface
// The new sets will be named as defined in the LIST $Set_Names, defined at the top of the macro.
// ------------------------------------------------------------------------

// Initialise a new counter variable
INT $Counter = 0

// Loop through the set names defined at the beginning of the macro.
// If a set of this name already exists, create a new UNIQUE name based upon this name using the NEW_ENTITY_NAME function.
FOREACH $SName IN $Set_Names {
// If the SET already exists, create a new one with a unique name
IF ENTITY_EXISTS($entity('level', $SName)) {
${$Set_Names[$Counter]} = NEW_ENTITY_NAME('level', $SName)
}

// Note the use of the ${expression} syntax. This is used to force the evaluation of multiple variables.
//CREATE LEVEL ${$Set_Names[$Counter]} MODELCOMPSET
CREATE LEVEL ${$Set_Names[$Counter]} LEVEL

// Aquire the current surface color into the Set
CALL AcquireColor($Set_Names[$Counter], $RGB_Values[$Counter])

// Advance the counter
$Counter = $Counter + 1
}

DELETE LEVEL "0"

CALL collisionPart()

CALL ignorePart()

DRAW LEVEL "ROTOR"

//STRING $Selected_Model
//STRING $temp_path = "C:\temp\"
//CALL convertModelToBlock ()

}

// I consolidated all of the functions into one generic function
Function AcquireColor(STRING setName, STRING rgbValue) {
EDIT SELECTION MODEL CLEAR
EDIT SELECTION MODEL FILTER $rgbValue
EDIT LEVEL $setName ACQUIRE SELECTED
EDIT MODEL ALL DESELECT ALL
}

Function collisionPart () {
UNDRAW LEVEL "STOCK"
UNDRAW LEVEL "ROTOR"
ACTIVATE LEVEL "CHUCK"
EDIT THICKNESS DEFAULTLIST UPDATE\r 1 NEW
EDIT LEVEL # SELECT ALL
EDIT THICKNESS COMPONENTS COLLISION
EDIT THICKNESS RADIAL_OFFSET "0,5"
EDIT THICKNESS ACQUIRE
THICKNESS APPLY
THICKNESS ACCEPT
UNDRAW LEVEL #
}

function ignorePart() {
DRAW LEVEL "STOCK"
ACTIVATE LEVEL "STOCK"
EDIT THICKNESS DEFAULTLIST UPDATE\r 3 NEW
EDIT LEVEL # SELECT ALL
EDIT THICKNESS ACQUIRE
EDIT THICKNESS COMPONENTS IGNORE
THICKNESS APPLY
THICKNESS ACCEPT
UNDRAW LEVEL #
}

function convertModelToBlock () {

DRAW LEVEL "STOCK"
ACTIVATE LEVEL "STOCK"
STRING $temp_path = "C:\temp\"
EXPORT MODEL $Selected_Model ${$temp_path + $Selected_Model + ".dmt"} YES
EDIT BLOCKTYPE TRIANGLES
GET BLOCK ${$temp_path + $Selected_Model + ".dmt"}
EDIT BLOCK COORDINATE WORLD
DELETE FILE ${$temp_path + $Selected_Model + ".dmt"}
//DELETE MODEL $Selected_Model
}

 

Thanks,

Jacob

1 REPLY 1
Message 2 of 2
cfastNJWK6
in reply to: jedQB94J

You have a comma in your value for radial thickness:

 

It would also be a good idea to make sure the toggle for using axial thickness is turned on. Change your collisionPart function to the following:

Function collisionPart () {
UNDRAW LEVEL "STOCK"
UNDRAW LEVEL "ROTOR"
ACTIVATE LEVEL "CHUCK"
EDIT THICKNESS DEFAULTLIST UPDATE\r 1 NEW
EDIT LEVEL # SELECT ALL
EDIT THICKNESS COMPONENTS COLLISION
EDIT THICKNESS AXIAL_RADIAL_OFFSET ON
EDIT THICKNESS RADIAL_OFFSET "0.5"
EDIT THICKNESS ACQUIRE
THICKNESS APPLY
THICKNESS ACCEPT
UNDRAW LEVEL #
}

 

 

 

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

Post to forums  

Autodesk Design & Make Report