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: 

Macro to create stock model from stl file that programmer has to file select

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
glen_h
835 Views, 7 Replies

Macro to create stock model from stl file that programmer has to file select

Hello all, hope you are all safe and sound these days.

I am writing a simple macro to create a stock model from an .stl file....user will have to select file by browsing.

I keep getting errors, because there are commands after the "GET BLOCK FILEOPEN" without giving the user a chance to choose the .stl file. I've tried using a MACRO PAUSE, but that didn't matter. Also the MESSAGE INFO causes an error as well.

I'm sure it's probably something quite simple, but I cannot figure it out!

 

FORM BLOCK

EDIT BLOCK ALL UNLOCK

DELETE BLOCK

EDIT BLOCK COORDINATE WORLD

EDIT BLOCKTYPE TRIANGLES

GET BLOCK FILEOPEN

//STRING Msg1 = "CHOOSE YOUR STL FILE"  ********PRODUCES AN ERROR IF UNBLOCKED WITH //

//MESSAGE INFO $Msg1  ********PRODUCES AN ERROR IF UNBLOCKED WITH //

DRAW BLOCK

EDIT BLOCK DRAWMODE 29

ROTATE TRANSFORM FRONT

FORM RIBBON TAB "StockModel"

CREATE STOCKMODEL ; FORM STOCKMODEL

EDIT STOCKMODEL "1" STEPOVER "0.03"

EDIT STOCKMODEL "1" TOLERANCE ".001"

EDIT STOCKMODEL "1" WORKPLANE "HERMLE"

EDIT STOCKMODEL "1" REAPPLYFROMGUI

EDIT STOCKMODEL ; BLOCK ;

EDIT STOCKMODEL ; CALCULATE

FORM RIBBON TAB "Home"

 

CAPTURE1.gif

 

Thanks in advance,

Glen

 

Big thanks to all who contribute!
My opinions are my own and are not intended to reflect yours.
Labels (3)
7 REPLIES 7
Message 2 of 8

Glen, 

 

What if you turn off the error messages?

 

DIALOGS MESSAGE OFF
DIALOGS ERROR OFF

Jonathan Artiss
Senior Applications Engineer | DSI

Autodesk Expert Elite member
DSI, Design and Software International Autodesk Gold Partner

Message 3 of 8

Something like:

 

DIALOGS MESSAGE OFF
DIALOGS ERROR OFF

GET BLOCK FILEOPEN

//STRING Msg1 = "CHOOSE YOUR STL FILE"  ********PRODUCES AN ERROR IF UNBLOCKED WITH //

//MESSAGE INFO $Msg1  ********PRODUCES AN ERROR IF UNBLOCKED WITH //

DIALOGS MESSAGE ON
DIALOGS ERROR ON

DRAW BLOCK

Jonathan Artiss
Senior Applications Engineer | DSI

Autodesk Expert Elite member
DSI, Design and Software International Autodesk Gold Partner

Message 4 of 8

@glen_h 

 

Why not just place a macro pause.

 

MACRO PAUSE "Choose your STL file"

Christopher Marion
Technical Specialist - CAM
SolidCAD - Canada





Message 5 of 8
rafael.sansao
in reply to: glen_h

STRING $Filename = ""
$Filename = FILESELECT "CHOOSE YOUR STL FILE" "*.stl"
IF $Filename == "" {
	MACRO ABORT
}
FORM BLOCK
EDIT BLOCK ALL UNLOCK
DELETE BLOCK
EDIT BLOCK COORDINATE WORLD
EDIT BLOCKTYPE TRIANGLES
GET BLOCK $Filename
DRAW BLOCK
EDIT BLOCK DRAWMODE 29
ROTATE TRANSFORM FRONT
FORM RIBBON TAB "StockModel"
CREATE STOCKMODEL ; FORM STOCKMODEL
EDIT STOCKMODEL "1" STEPOVER "0.03"
EDIT STOCKMODEL "1" TOLERANCE ".001"
EDIT STOCKMODEL "1" WORKPLANE "HERMLE"
EDIT STOCKMODEL "1" REAPPLYFROMGUI
EDIT STOCKMODEL ; BLOCK ;
EDIT STOCKMODEL ; CALCULATE
FORM RIBBON TAB "Home"

Rafael Sansão

EESignature

Message 6 of 8

@Jonathan.Artiss-DSI 

 

That didn't seem to work, plus it doesn't allow for a message to tell the user what to do.

 

Thanks,

 

Glen

Big thanks to all who contribute!
My opinions are my own and are not intended to reflect yours.
Message 7 of 8
glen_h
in reply to: ChristopherMarion

@ChristopherMarion 

 

I tried the macro pause...I get the same error.

Something to do with having the file selector window open doesn't seem to allow any other commands until file has been chosen.

Thanks,

 

Glen

Big thanks to all who contribute!
My opinions are my own and are not intended to reflect yours.
Message 8 of 8
glen_h
in reply to: rafael.sansao

@rafael.sansao 

 

Thank you Rafael. The macro worked nicely.

I see the "choose your stl file" at the top of the file selector window, as shown below:

CAPTURE1.gif

 

I was hoping to have a message window pop up telling the user to select the stl just before the file selector opens up, but this will absolutely work!

Thanks again, and I will mark this as accepted solution.

Have a great day!

Glen

Big thanks to all who contribute!
My opinions are my own and are not intended to reflect yours.

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

Post to forums  

Technology Administrators


Autodesk Design & Make Report