PowerMill macros with variables

PowerMill macros with variables

Anonymous
Not applicable
7,586 Views
27 Replies
Message 1 of 28

PowerMill macros with variables

Anonymous
Not applicable

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...

https://youtu.be/zqtqQ37VCH4

 

So if there‘s anybody to help me I would be so grateful.

 

regards

David

 

0 Likes
Accepted solutions (2)
7,587 Views
27 Replies
Replies (27)
Message 21 of 28

5axes
Advisor
Advisor
Accepted solution

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

Anonymous
Not applicable

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

0 Likes
Message 23 of 28

kukelyk
Advisor
Advisor

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

kukelyk
Advisor
Advisor

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'

0 Likes
Message 25 of 28

kukelyk
Advisor
Advisor

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

Anonymous
Not applicable

@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!!!!!

0 Likes
Message 27 of 28

kukelyk
Advisor
Advisor

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

 

What did You modify at last?

0 Likes
Message 28 of 28

Anonymous
Not applicable

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

Works fine! 🙂