Skip to main content
1-Visitor
January 20, 2017
Solved

Macro to export CGM

  • January 20, 2017
  • 1 reply
  • 7236 views

Hello everyone.

I am very new to IsoDraw, using v7.3, and I have a small issue.

I want to convert .CGM file to its clear text encoding. I know my input file is encoded in binary and I want to use a command line to convert it to clear text encoding. There are a few things I don't understand :

- What should be the command like ? For now I've been trying to change many subtleties but nothing seems to work.

I always start with this : [path_to_isodraw.exe]\IsoDraw73.exe -s"path_to_source_file" -d"path_to_destination_file" . Then I try to use a simple macro with this only command "Export "path_to_cgm" "CGM". I checked in the preference file for my specific parameters and it seems ok. This macro is saved in my C:\User\myname\AppData\Roaming\ptc\Isodraw\Macro so I add this to my command line, giving this :

[path_to_isodraw.exe]\IsoDraw73.exe -s"path_to_source_file.cgm" -d"path_to_destination_file.cgm" -m"C:\C:\User\myname\AppData\Roaming\ptc\Isodraw\Macro\convertCGM.ism".


Now others questions I have are the following :

- There is a destination file in the command line and another one in the export line of the macro. Doesn't this create a conflict ? To make things simpler, I use the same path but.. still.

- I know there's a -f10 command line option that allows to convert in CGM. How does it precisely work ? Does it conflicts with the export command of the macro ?

- This command worked once on a test file. I tried it again on another file and I could'nt make it work again. Am I missing something ?

- Imagine I want to specify my Export "CGM" command. Let's say one to convert into binary and the other to convert into clear text. Is this possible ? I tried to do some changes in the preference file (changing CGM to CGMBinary and adding CGMText) but this doesn't seem to work. I guess we can't add new commands ? Are we supposed to change the parameters each time ?


That's it for now, thank you in advance for any help. I've looked around the forums, guides and help but couldn't find anything useful, so any help is appreciated

Best answer by thendricks

I apologize for not being more thorough the first time. I just knew that the macro name was used. I've gone through and tested on mine. Here is the syntax to use.

[Install location]/IsoDraw73.exe [Path to file] -macro [Macro name]

I'm guessing you might have looked at older documentation as I have a vague recollection that the syntax changed a few versions back.

Also note that you may need to add the following line to your macro to close IsoDraw when the macro is done. Otherwise it may leave a running instance.

     Quit Confirm_Yes

1 reply

12-Amethyst
January 20, 2017

I think you might be making this more complex than needed though I'll answer some of your other questions as well.

First, open IsoDraw, and assuming you're on a more current release we're on 7.3), you should find 'Batch process...' under 'File' in the menu. You can then select a folder of files you want to convert. Pick a destination (do not do the same folder), and the options to export. Since you're just switching the export basically you shouldn't need a macro.

In regards to the some of the questions in your post, the settings for an export are stored in the preference file as it appears you are aware. Each time you reopen a file it goes back to these defaults. Once a file is created it does NOT get any updates from the preference file. It is stored in that file and only modifiable via the UI or via macro. So, when running a macro, if you simply do an export it will use those default settings. There are commands to automatically change these prior to export. I recommend this in case you have a needed export format and someone plays with the settings for the file. And yes, you would need to set this between each export.

As for the conflict, I'm not sure. Never tried. On the other hand, are you giving explicit paths? My guess if they are the same path is that the file opens, runs the macro creating the file (no lock), and then your destination file is created overwriting the previously exported file.

1-Visitor
January 23, 2017

The thing is that I need to call IsoDraw from my java code. So I'm testing it from a console and it seems that command lines aren't much customizable. I saw in the documentation that starting from 7.1, this is the generic command : "[path]\IsoDraw7.exe" -ext <plugin name> -s<path of source files>
-d<path of destination files> -f## -c<scale value> -m<name of the macro>

As I need to execute a command to export in the right CGM format, what would be the command to just make an export ? Since I can manually change the preference file, I don't need to do anything special in the command, just call the macro that export to CGM. At least, that's how I understand it.

I am always giving the whole path to my files (I am not using "..\..\myfile" but always "D:\path\to\myfile").

12-Amethyst
January 23, 2017

Ah. Now I understand the direction. I didn't actually test the below but it should work.

Macro CGM_Export

     #Various cgm export settings. Listed only a few that might help.

          #Sets export profile for cgm.

               app.cgm.profile = $CGM_Profile.ATA_GREXCHANGE_2_9

          #Sets encoding to text.

               app.cgm.profile = 2

          #CGM version

               app.cgm.version = 1 

   

#Exports cgm to the same directory as the source file.

     Export StripExt(ActiveDoc.Path) + ".cgm" CGM

End Macro