Jump to content
Developer Wiki and Function Reference Links ×

Basic file operations?


Petri

Recommended Posts

I can't figure out how to save a file with a name generated in a script. My last hurrah was to create a text object with the file name and copy that to the clipboard, for the user to paste in the dialog, but (of course) even that failed. I've even copied the text by selecting the text in a text object and it has not crossed Jordan to the Save-dialog.

The only AppleScript event we have is DoScript. No VW-specific AS-library, no way to do even the most basic file operations. If Windows-compatibility means lack of capabilities for all, why do the Rest of Us need to suffer?

Link to comment

If you are going the route of dialogs, have you tried the "GetFileN" function?

FUNCTION GetFileN(title :STRING; defaultFolder :STRING; mask :STRING; VAR fileName :STRING) :BOOLEAN;

Also, does the "SaveActiveDocument" function work?

FUNCTION SaveActiveDocument(filePath :STRING) :LONGINT;

I have not tried SaveActiveDocument yet, but I have used GetFileN and passed in a generated file name.

Link to comment
..now I still need to Export as DWG... or rather as Industry Foundation Classes!

Hmmm. Well I wrote a DXF exporter and an EJE and Fabtrol KISS exporter for a structural steel application some years ago. There is an IFC XML schema. And it looks like Vectorscript can read and write XML. If somebody will pay me to do it, I can develop an IFC import/export program.

Cheers,

Link to comment

Actually, the IFC XML might be quite an interesting one. It might be a means of exporting non-graphic data to non-CAD -programs directly. I once wrote a MapInfo export translator which, among other things, translated graphic data to non-graphic. One version created graphic data that did not correspond to VW data at all, except for the location. The representation was done in the translation.

I think there could well be a future market for intelligent translators. The DXF/DWG format is, after all, extremely dumb data dumping - so dumb that even Autodesk does not support translation from AutoCAD to Revit.

This comment is not intended to belittle the heroic efforts of countless talented programmers who - under the auspices of Open DWG Alliance and NNA - have been able to make sense of DXF/DWG and introduce syntactic structures well beyond the capabilities of Autodesk programmers and lexical translations in which the toddler-speak of AutoCAD has been interpreted as something meaningful.

Link to comment

SaveActiveDocument works for me.

It returns -1 if the document already exists and a zero if it doesn't. (And it saves the document...:))

{start}

Procedure Saveme;

VAR

en:STRING;

nu:LONGINT;

BEGIN

nu:=SaveActiveDocument('testdoc');

en:=Num2Str(0,nu);

AlertInform('output:',en,TRUE);

END;

RUN (Saveme);

{end} tongue.giftongue.gif

Edited by supermannetje
Link to comment

OK, thanks to all. Now the only thing that is missing is Batch Export as DXF/DWG.

I can generate the scripts in FileMaker Pro and even run them directly from FMP - but in this case I don't have use for a series of VW files.

The idea is to be able to split a VW symbol library document into individual AutoCAD-files. Possibly also doing "symbol assemblies" on the fly.

Link to comment

Petri, how complex are the symbols? Can you export the symbol library document successfully as one single AutoCAD drawing where the AutoCAD block definitions are consistent with the Vectorworks symbol definitions?

If you can export an uncorrupted AutoCAD drawing, it might be easier to write a simple LISP or VBA routine that will split them into individual AutoCAD files.

Regards,

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...