Jump to content
Developer Wiki and Function Reference Links ×

select lines & extend each by 250mm?


Recommended Posts

I have annotated a large drawing and I need to extend a number of lines by 250mm (lines with arrow on one end) - there are 1000's of them!

Is this possible using vectorscript to select all lines of a specific class and extend them each by a set distance? each line is currently a different length, fortunetly the lines are always drawn from the same end, so extending will add onto the correct end.

Thanks for any assistance.

Link to comment

You can do this without VS.

Use a custom selection with the following criteria:

Type is Line

(more choices)

Class is XXX

Once the objects are selected, go to the OIP and choose the end to lock using the box position control (looks like a tic tac toe board)

If the lines are perfectly horizontal or vertical, place the cursor at the end of either X or Y and enter +250, then press enter.

If the lines are a mixture of different angles, switch to the polar coordinate system and add +250 at the end of the Length (L) field.

Link to comment
You can do this without VS.

Once the objects are selected, go to the OIP and choose the end to lock using the box position control (looks like a tic tac toe board)

If the lines are a mixture of different angles, switch to the polar coordinate system and add +250 at the end of the Length (L) field.

But when you select more than 1 line, you can't see that in the info pallet, so you can't do it that way.

Or is this changed in VW12? (tested in VW11.5.1)

Link to comment

Jezscott,

The following script extends the arrow end by 250mm.

PROCEDURE ExtendLine;

{DEBUG}

CONST

kEXTENSION = 250mm;

PROCEDURE ProcessLine(lineHdl: HANDLE);

VAR

size: REAL;

lineVec: VECTOR;

arrow1,arrow2: BOOLEAN;

style,angle: INTEGER;

p1X,p1Y,p2X,p2Y,lineLen: REAL;

BEGIN

GetSegPt1(lineHdl,p1X,p1Y);

GetSegPt2(lineHdl,p2X,p2Y);

GetObjArrow(lineHdl,style,size,angle,arrow1,arrow2);

IF arrow1 THEN

BEGIN

lineVec[1]:= p1X - p2X;

lineVec[2]:= p1Y - p2Y;

lineLen:= Norm(lineVec);

lineVec:= (lineLen + kEXTENSION) * UnitVec(lineVec);

p1X:= p2X + lineVec[1];

p1Y:= p2Y + lineVec[2];

SetSegPt1(lineHdl,p1X,p1Y);

END

ELSE

BEGIN

lineVec[1]:= p2X - p1X;

lineVec[2]:= p2Y - p1Y;

lineLen:= Norm(lineVec);

lineVec:= (lineLen + kEXTENSION) * UnitVec(lineVec);

p2X:= p1X + lineVec[1];

p2Y:= p1Y + lineVec[2];

SetSegPt2(lineHdl,p2X,p2Y);

END;

END;

BEGIN

ForEachObject(ProcessLine,(((C='LineClass') & (T=LINE))));

END;

Run(ExtendLine);

Link to comment
  • 1 month later...

wow! thanks Miguel

I can't get it to work though

I'm using Vectorworks 12.5 on MacOSX

- I save your script as a txt file

- in VW resourses I make a new vectorscript

- I name it

- load from the text file

- OK

- I select the lines

- double click the script, but nothing happens

I'm sure I'm just loading it wrong.

any ideas?

Thanks JEz

Link to comment

JEz,

The script Miguel so kindly made for you is looking for lines assigned to the class "LineClass". In order to make it work, change the line of code near the end to match the name of the class that your lines are assigned to.

The line currently reads:

ForEachObject(ProcessLine,(((C='LineClass') & (T=LINE))));

Make sure to keep the single quotes - just change LineClass to whatever your class name is.

HTH

V-Geek.

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