jezscott Posted July 5, 2007 Share Posted July 5, 2007 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. Quote Link to comment
Guest Posted July 5, 2007 Share Posted July 5, 2007 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. Quote Link to comment
Dieter @ DWorks Posted July 5, 2007 Share Posted July 5, 2007 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) Quote Link to comment
jezscott Posted July 5, 2007 Author Share Posted July 5, 2007 nope - can't alter more than one line at a time with OIP Quote Link to comment
Ray Libby Posted July 6, 2007 Share Posted July 6, 2007 Wouldn't the 2D Reshape tool work for this? Select all the lines, choose the 2D Reshape tool, draw a marquee around the handles you want to move, Move command>250mm Quote Link to comment
Gerrit Posted July 6, 2007 Share Posted July 6, 2007 Once selected, a ForEachObject procedure would be a solution - if only one could define the reference point of each individual line? Quote Link to comment
jezscott Posted July 6, 2007 Author Share Posted July 6, 2007 Gerrit - your suggestion could work. ForEachObject, retrieve line length, add 250mm, update, next any suggestions how to combine this into a script? Quote Link to comment
Miguel Barrera Posted July 7, 2007 Share Posted July 7, 2007 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); Quote Link to comment
jezscott Posted August 8, 2007 Author Share Posted August 8, 2007 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 Quote Link to comment
VectorGeek Posted August 8, 2007 Share Posted August 8, 2007 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. Quote Link to comment
Miguel Barrera Posted August 9, 2007 Share Posted August 9, 2007 Yep V-Geek, that is correct. I forgot to mention it because I thought it was obvious. I will try to explain more in depth or add comments to a script in the future. Sorry JEZ. Quote Link to comment
Recommended Posts
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.