Hey guys,
i've been experimenting with the file saving/exporting options, but i've got no clue how i can access the options hidden in the DXF export options dialog.
I found this in the api, but it doesn't seem to be available: https://community.coreldraw.com/sdk/api/draw/20/c/dxfexport
It also seems there's a way to create an ExportFilter of sorts that should be able to set the required version, but i can't figure that part out.
Can someone help me with this?
Thanks in advance!
Maybe you will find what you need here...
I think the trick will be to add a reference to the appropriate .flt library. It would be found on the next kind of path: "...\Corel_Installation_Folder\Filters64(or Filters for 32bit)\IEDXF.flt".
You should browse to that folder (in EDE: Tools -> References... -> Browse... and go to the above suggested path. You will select 'All Files' from 'Files of type:'...
After that the declaration Dim FilterObject As DXFExport will have a meaning and you can choose the filter properties/methods just selecting the options in a With - End With sequence like in the next picture:
Hmm thanks. Altho i'm not quite sure how to reference .flt files. Neither Visual Studio (trying to export files using C#), nor the VBA Macro IDE seems to be able to create a reference to those .flt files and a fitting .dll is sadly not available. :S
Thanks FaneDuru.
I'm using 2019 64bit, sadly my 2018 version has some trouble installing addons (i suspect it's cause it's a 32 bit version that i'm running on a 64bit system), however i also should have a X7 Version that i could install and try it with.
Anyway, i repeated all steps as you instructed but i'm still getting the error that the file can't be referenced when trying to add it.
Sorry for the language... should've installed it in english. ^^
It looks they 'improved' it...
X8 allows referencing of this file type as I explained. X6 does the referencing operation in the same way. Just tested. The reference name shows 'FilterDXFLib'...
No problem with your German interface. Some time before I learned a little German...
And anyhow, English is not my native language, too.
In this case I do not imagine how you can solve the problem. I do not have 2019 installed to try something by myself. Please check if your installation does not also have .dll or some other compatible file (.olb, tlb). Maybe they did that since 2019 version does not allow such a type referencing. In the link I firstly suggest they were speaking about .dll. I did that 'trick' because I did not have such an option, not .dll existing in that location. I would suggest you to try finding all files (in Corel Installation Folder) named IEDXF. Maybe you are lucky and find a .dll able to be referenced in C#, too.
Hmm, i think we got it wrong... i experimented a bit and it seems that using ExportFilter applies to all available kinds. Using this actually exported my file with the right version:
Public Sub Export()Dim filterObject As ExportFilterSet filterObject = ActiveDocument.ExportEx("testr11.dxf", cdrDXF)With filterObject.Version = 6.FinishEnd WithEnd SubNow i just need to figure out how to call that macro from a C# addon, or even better, somehow do that in C# itself. xD
Sadly there's no way to access the Version property in C#. (Or at least i didn't find one)
I am afraid it is not possible to obtain the export (CAD) Version without having the right reference to that filter...
For instance, I can see the specific export Dialog (in VBA after correct referencing), I can change/set the Export Version (manually or programmaticaly) and than collect it in Immediate window...
After editing:
I was wrong...
I tested your code (in VBA) and even if the global filter looks to not having any Version property (just writing a dot in With - End With iteration), putting .ShowDialog, it shows the DXF export options and for Version 6 it is AutoCAD R9...
Ya, multiple Versions work for my purposes, just not the default one. Just tested it showing the dialog, seems Version 4 is actually AutoCad R11.
Still leaves me with the issue that i need to call that macro from a C# addon or somehow do that in C# itself. :D Maybe Former Member has an idea?
Thanks guys!
I remembered I played some time before with a Corel docker client, able to be connected to a server.exe application doing a lot of things... The server can start multiple sessions of Corel and access each of them according to their process ID sent back by the client docker...
Making the story shorter, the code able to run a specific procedure from a specific GMS file looks like this:
private void runProcedures(string GMSName, string moduleNameProc, object[] myObjArray) { gms = corelApp.GMSManager; if (this.corelApp.InitializeVBA()) { if(myObjArray[0].ToString() == "Empty") { gms.RunMacro(GMSName, moduleNameProc, null); }else { gms.RunMacro(GMSName, moduleNameProc, myObjArray); } } }
If I remember well, 'moduleNameProc' was a string composed from module name and procedure name, dot separated ('moduleName.ProcedureName').
'MyObjArray' is used for parameters in case of functions/procedures being called with parameters...
But, this should be just a kind of workaround... I usually do my best to obtain everything in C#. Now I do not have enough time and I must confess I lost my initial entuziasm...
Wow okay... thanks. I'll give that a try and report back! Thank you so much.
Well ya, same goes for me, but as long as i can't find out how to export using C#, i'm glad to have the ability to use macros. I mean... it makes no difference to the process itself, it just isn't exactly pretty having to relate to macros to get partial things done.Edit: Thanks again, calling the macro worked perfectly.
Nice...
I'm glad for you.