Jump to content
Sign in to follow this  
GioPet

Bug with drawings created with older VW versions

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

Share this post


Link to post

Just to be sure both documents have the same version right ?

If for whatever reason the number of stored digits changed, can't you just "reset" all objects prior to copying them over ? If that doesn't help I can only assume the data is lost while copying.

Edited by Hippocode

Share this post


Link to post

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.

Share this post


Link to post

I tried centering the drawing on the Internal Origin and setting the User Origin to the Internal Origin. Unfortunately it did not resolve the problem..

Share this post


Link to post

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

Share this post


Link to post

LObject isn't for the last object that was created:

Function LObject returns a handle to the last object in the first layer of the active document.

Use LNewObj, which is exactly to get the last created object:

Returns a handle to the last object created by a VectorScript function call during the current script execution.

Share this post


Link to post

@GioPet: I'm very interested in what's not working and want to find out together what needs to be done to get it to work. I would love to add it to DLibrary once we have the solution.

It's what DLibrary is for: wrapping VS and avoid all weird stuff in it, making it easier to work with objects etc...

Edited by Dieter @ DWorks

Share this post


Link to post

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.

Share this post


Link to post

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.

Sign in to follow this  

 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...