Community Tip - Did you know you can set a signature that will be added to all your posts? Set it here! X
209c292858
and then another such as... 209c292858
Then just check the value of this variable in your if statement used in Change_and_Maybe_Save_Down.
In IsoDraw 7.1 you can pass parameters to submacros like this:
SubMacro Change_drawing( Boolean save_down )
If ( save_down ) Then
# Change and Save Down ...
Else
# Change only ...
End If
End SubMacro
Macro Test_Change_drawing
Run Change_drawing( true )
# or
Run Change_drawing( false )
End Macro
Hi,
Actually I have two problems about this topic :
- First, I can't see the code examples quoted in this topic, all I can see is :
In IsoDraw 7.1 you can pass parameters to submacros like this:
d008373291
- Next, I really need to pass parameters to a macro, but in a command line like this :
C:\Program Files\PTC\Arbortext IsoDraw 7.1\Program\IsoDraw71.exe file.cgm -macro macroName(parameter)
The PTC support told me that was possible, but they are not able to tell me how to write the macro to get the parameters. I tried several ways :
-> Macro macroName(String param) : I have a 'parameter error ""'
-> Macro macroName(define param as String) : isodraw crashes
-> Macro macroName(param) : isodraw crashes
Can anyone help me, please?
Thanks
Damien
In regards to the code not being visible, it appears that when they updated to this new forum format they lost anything marked as code as well as many of the attachments.
I've attached what I was given from PTC support about running from the cmd line. I've used it quite a bit, but don't recall anything showing the possibility of specifying a parameter. Can you explain what you are attempting to do in more detail? The more specific, the better.
First of all, thank you for your instant answer!
About the code quotes, I already had your embeded text file from PTC support, but thank you.
Here are my needs:
- Open automatically a lot of cgm files (more than 2000)
- Create several active areas in each cgm files at some exact places defined in an other file.
- Save each cgm file
I tried several ways to reach my needs :
- I found a way in this forum to read a text file in a variable and so get the information about the active areas. But Isodraw is not enough robust to bear so much charge. I had some random bad behaviour, with or without the collection treatment.
- Now, I'm making a java program which will read the information about the active areas and I would like to launch from this Java program, a macro having as parameter the information about the active area and let Isodraw do only its job : create the active area.
- Waiting for an answer about parameters, I'm trying to create from my java program a new macro file for each cgm file which will create all the active areas, and launch it.
Any idea?
Thanks again.
ps : Benno, I just saw your answer, I think I already tried this solution, it wasn't working. I'll try again to be sure, thanks anyway.
Hi,
I restored the code snipplet above. This:
Macro macroName(String param)
# Do something with param
End Macro
would be the right thing in your case. To resolve the parameter error, check the quotes in the command line.
E.g. this should work:
IsoDraw71.exe file.cgm -macro macroName("ABCD")
Please note that environment variables in the cmd shell are resolved without quotes, so they also need to be quoted,
if you want to pass them as string parameters to a macro:
IsoDraw71.exe file.cgm -macro macroName("%MY_ENVIRONMENTVAR%")
Hi,
Well, my new test seems to work... I'm trying with my whole treatment.
Thank you,
Damien
Hi,
I tried with my whole treatment but I failed 😕
I only used the Isodraw macro to create an active area in a graphic file, so it means a lot of macro calls, between 1 to around 20 for one graphic file, and I have more than 2000 graphic files.
The problem is that Isodraw doesn't manage so many quick macro calls on the same file. Between each active area, I have to save and close the file, to keep the changes, and really soon, Isodraw tells me that the file is still opened. I tried to put a timer between each macro call, but it would need several seconds to let enough time for the treatment, and it's far too much.
I know it would be better to have a macro for a graphic file and not for an active area, but the number of active areas is not fixed. And I would need an array or something like that to pass in parameter to the macro, but I didn't find anything about this in this forum or in the documentation.
You can find attached my Isodraw macro file, my java program and an instance of active area information file (.hts).
Any idea?
Thanks.
Damien
As another approach, you might want to look at using the batch tool that comes with IsoDraw. It allows you to cycle through a folder of files and run a macro on each.
In regards to the macro, reference the alternate forum thread about getting input from an outside file. A generic overview would be something like what follows:
1) When each file is opened, a macro is run.
2) Text element is created and mock text excerpt is created.
3) The macro loops calling out a batch/java file giving the name of the hts file needed for input as well as a line number (loop in IsoDraw just keeps adding one to line number each time it processes.
4) Batch/java references that line and updates the text excerpt.
5) IsoDraw import file (pause will be necessary to allow batch/java to run).
6) String is validated (If nul, exit loop. If not nul, continue.)
7) Parse string and create your active area.
😎 Add to line number, export text excerpt...
It wouldn't be terribly fast, but once set up, you could allow it to run overnight.