Problem with Macro to load triangle block definition

Problem with Macro to load triangle block definition

Jason_McDaniel
Participant Participant
722 Views
6 Replies
Message 1 of 7

Problem with Macro to load triangle block definition

Jason_McDaniel
Participant
Participant

Hello. I'm not sure of the correct syntax I need to get this to work. I'm trying to write a macro to load an exported ViemMill model as block.

 

FORM BLOCK
EDIT BLOCKTYPE TRIANGLES

// Open Import Browser
STRING $VarModel = ''
$VarModel = FILESELECT "Please select a exported ViewMill state file"


// Load exported ViewMill state model as new Block
GET BLOCK FILEOPEN $VarModel


EDIT BLOCK COORDINATE WORLD
DRAW BLOCK
BLOCK ACCEPT

 

I'm getting the following error: "Unable to open block definition file '$VarModel' from line 10.

What am I doing wrong?

 

Thank you,

Jason

0 Likes
Accepted solutions (1)
723 Views
6 Replies
Replies (6)
Message 2 of 7

iamcdn79
Mentor
Mentor
Accepted solution

Try 

 

 

FORM BLOCK
EDIT BLOCKTYPE TRIANGLES

// Open Import Browser
STRING $VarModel = ''
$VarModel = FILESELECT "Please select a exported ViewMill state file"


// Load exported ViewMill state model as new Block
GET BLOCK $VarModel


EDIT BLOCK COORDINATE WORLD
DRAW BLOCK
BLOCK ACCEPT

 


Intel Core i9 13900KF CPU
128 GB Kingston Beast DDR4 SDRAM
PNY RTX A2000 6GB Video Card
WD 1 TB SSD Hard Drive
Windows 11 Pro

Message 3 of 7

kevin.hammond3WX4X
Advocate
Advocate

Try this....

 

FORM BLOCK
EDIT BLOCKTYPE TRIANGLES
EDIT BLOCK COORDINATE WORLD
// Open Import Browser
STRING $VarModel = ''
$VarModel = FILESELECT "Please select a exported ViewMill state file"

// Load exported ViewMill state model as new Block
GET BLOCK $VarModel
BLOCK ACCEPT

Message 4 of 7

Jason_McDaniel
Participant
Participant
This works. Thank you. 🙂
0 Likes
Message 5 of 7

Jason_McDaniel
Participant
Participant
This works. I don't know why I thought I needed the FILEOPEN command there. Thank you. 🙂
Message 6 of 7

urizenYHS3W
Advocate
Advocate

FILEOPEN raises the file browser and puts you into a state where PowerMill variables aren't known. I would recommend not using FILEOPEN FILESAVE when writing macros unless you really want the user to interact with the file system via the browser.

Message 7 of 7

Jason_McDaniel
Participant
Participant
Good to know. Thank you.
0 Likes