Jump to content
Developer Wiki and Function Reference Links ×

Bug with drawings created with older VW versions


GioPet

Recommended Posts

When using files created with an older version of Vectorworks (or from an old template file) I have come across this problem:

- if I use HCenter to get the coordinates of a handle, then create a rectangle in that point using RectangleN, the function doesn't work at all.

- The coordinate values in the old drawing have 4digits before decimal point and 10 digits after. If I copy and paste in place the same rectangle into a new document, the coordinates in the new documents have 5 digits and no decimal point at all.

The Document Settings and Unit settings of the two files are identical.. so there seems to be a problem with the X and Y values of points in the drawing space of old drawings.

Does anybody know anything about this behaviour and how to resolve this problem??

thanks for any suggestion

G

Link to comment

Yes, the two documents are saved with the same version, but one is newly created and the other has been converted from a Vectorworks 2009/2010.

I tried the following to rest all objects and their bounding box, but the issue still remains:

PROCEDURE RESETIT;

FUNCTION ForAll(Hnd: HANDLE) :BOOLEAN;
BEGIN
SetSelect(Hnd);
ResetObject(Hnd);
ResetBBox(Hnd);
END;            { ForAll }

BEGIN
DSelectObj(All);
ForEachObjectInLayer(ForAll, 0, 2, 1);
END;
RUN(RESETIT);

Rather than the issue with copying objects between two documents, my main problem is that the function RectangleN is not capable of creating a rectangle when I use HCenter to get the coordinates of an existing object in the document which I want for the insertion point for the new rectangle.

Link to comment

I can't find SymLoc in the vectorscript functions reference..

on the other hand, I need to read the center of the bounding box because that's where I want a new rectangle to be created (then move/edit it from there through other functions).

doing some more testing, I realised that the function that is not 'working' properly is LObject (to get the handle of the last object created) - it returns a point with crazy coordinates, therefore I get the problem getting HCenter for the last created object..

Exactly the same code works 100% fine with drawings that have been newly created with Vectorworks 2016..

Edited by GioPet
Link to comment

Thanks for jumping in Dieter!

I just realised that the LObject definition is different between function reference VW2015 and VW2016 .. I was obviously looking at the old one..

I understand now why my code with LObject makes the script work when there is only one Layer in the document..

so, I have replaced LObject with LNewObj, which works for the parts of my code where objects are created by vectorscript.

My script starts with a call to the rectangle tool - CallTool(-203) -

then i need to get the handle to the rectangle created by the user, which LSactLayer does correclty.

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