PowerMill Forum
Welcome to Autodeskโ€™s PowerMill Forums. Share your knowledge, ask questions, and explore popular PowerMill topics.
Showing results forย 
Showย ย onlyย  | Search instead forย 
Did you mean:ย 

PowerMill macros with variables

Message 1 of 28
4466 Views, 27 Replies

PowerMill macros with variables

Hello everyone ๐Ÿ™‚

Iโ€˜m from Germany so I hope youโ€˜ll understand me as good as you can.


I have to work with 5 models in my project which are everyday the same. Different in a small way.. But everytime the same steps. The only difference is, that the number of the 5 models is everyday another one, eg: 

17171010_I.        โ€”> 18181010_I

17171010_ISh     โ€”> 18181010_ISh

17171010_IE       โ€”> 18181010_IE

17171010_IOSur โ€”> 18181010_IOSur

17171010_ISUR  โ€”> 18181010_ISur


I can use macros for lots of operations now. But when I have to say: turn 18181010_I, 18181010_ISh (...) by 180 degrees or something like this. There is no way to use macros for me. But that would be so helpfull! I get a xsml file with my models everyday  where are the filenames included. The name of the xsml file and the sequence are always the same.

So is there any way to use macros with Variables? I saw this video but I donโ€˜t understand how to manage it...


So if thereโ€˜s anybody to help me I would be so grateful.





Message 21 of 28
in reply to: Anonymous

Yes it's generated every time and the modification must be done not in the C:\Temp\tempvbs.vbs file but in the Macro


In the Excellent code Smiley Happy of @kukelyk this file is generated via the Function VBS :

FUNCTION vbs(STRING read_xls_vbs, STRING xls) {

and the variable STRING read_xls_vbs  contains the path to the Vbs Script.  And this varaible is define in the begining of the code via this first line of codes


STRING read_xls_vbs = macro_path(0) + "\read_xls.vbs"

So check the result of your modifications  to validate this value


Message 22 of 28
in reply to: 5axes

I don't understand what I have to change exactly...

Message 23 of 28
in reply to: Anonymous

OK, so save the zip content anywhere (it is best if there are no whitespaces in this path..)

run the mac in Pmill.

I made some fixes, (thanks @5axes for the assistance :thumbsup: ) so please download this new version. Hopefully it can run in 2014R2, it works under 2016R2.


The vbs is generated by the macro function called vbs.



Message 24 of 28
in reply to: Anonymous

The "Modell beolvasรกsa.." means 'model import', it is a copied code from my other macro, change this hungarian string to any other text, like 'Excel file wahlen'

Message 25 of 28
in reply to: 5axes

5axes wrote:

Just one question : In the vbs script why do you create the initial DAT file in the C:\temp directory.  And not directly in the script directory ?

It is because the macro listens to the existence of that file, so during the stream writing, the macro should not read that. It is something like "When file is ready"

Message 26 of 28
in reply to: kukelyk

@kukelyk EUREKA!!! Everything works!!!! Now I can transfrom every single model although it has an different number everynumber/ID !!!!!!!!!

I've edited your get_models version 1.0 and it works with it.


Should I use your version 2.0? Are there new things? because you now: never change a running system ๐Ÿ™‚



Thank you so much!!!!!

Message 27 of 28
in reply to: Anonymous

There are minor changes, if the 1st version works, no need to switch to the new one.


What did You modify at last?

Message 28 of 28
in reply to: kukelyk

I've changed the path and what @5axes told me.

Works fine! ๐Ÿ™‚

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

Post to forums  

Technology Administrators

Autodesk Design & Make Report