callum.adams11 Posted April 14, 2017 Share Posted April 14, 2017 Hey, I was wondering if there was a way to set a 0, 0 on a design layer and have a symbol auto fill the distance from itself to 0, 0? I have A LOT of symbols to layout and label distances, and wondering if there's a quicker way... Best, Callum Quote Link to comment
Vectorworks, Inc Employee PVA - Admin Posted April 14, 2017 Vectorworks, Inc Employee Share Posted April 14, 2017 I THINK there is a way to do this with custom symbol records, but the tool I can think of that does this by default is the Stake object, which you should have if you own Designer or Landmark. It has a Label Reference option in the Object Info palette called "Label Reference" which does this if you set it to Coordinates (X,Y): Quote Link to comment
bcd Posted April 14, 2017 Share Posted April 14, 2017 Spotlight Hoists have been designed with this functionality. Custom set your Rigging Origin & each hoist can reference that. Quote Link to comment
callum.adams11 Posted April 15, 2017 Author Share Posted April 15, 2017 I'm looking for a more simple read out though (which Im thinking could be the difficult part) I just need a distance from point A to B, instead of an x,y read out.. Quote Link to comment
Pat Stanford Posted April 15, 2017 Share Posted April 15, 2017 OK, try this. I am including both the script for a PIO and the vso file. If you use the script, you will need to us the Plug-in editor and make a new Point object. It needs a single Parameter of type Control Point. By changing the defaults before inserting "Distance From" objects, you can control the initial placement of the text from the locus point. This object inserts a locus point a the point clicked (it takes a double click because VW objects are intended to be able to be rotated on insertion. Better to insert vertically and then rotate is necessary. I then adds a text block showing the distance from the origin (0,0) point of the file in the current document units. Let me know if this does or does not fit your needs. Procedure DistanceFrom; {©2017, Patrick Stanford, pat@coviana.com Licensed under the LGPL} {No Warranty Expressed or Implied. Test thoroughly before using on production data} {Make a backup copy before running} {May change data in hidden but selected objects in groups, symbols, etc.} {Do no operate heavy machinery while using. May cause drowsiness} {Lightly commented for use in learning VectoScript} {Puts a locus and a text block showing the distance from the origin (0,0) of the drawing at the location double clicked.} {Second click is necessary to account for the rotation input of PIOs. While the PIO may be rotated on insertion,} {the control point for moving the text block does not work properly on those instances. If the PIO is inserted "vertical"} {and the rotated, the control points continue to work. This appears to be plane related.} Var X1,Y1,X2,Y2, Dist: Real; {X1,Y1 are location of PIO object, X2,Y2 are the point it measures from} S1, S2: String; {S1 is the name of the PIO, S2 is the string used to display the distance} H1, H2, H3: Handle; {H1 is the handle to the PIO instance. H2 and H3 are used by GetCustomObjectInfo} B1: Boolean; {B1 is a dummy boolean required for the return data of GetCustomObjectInfo} Begin PushAttrs; {save drawing settings so the changes we make don't effect drawing environment} B1:=GetCustomObjectInfo(S1, H1, H2, H3); {Get info (name and handle) to the PIO instance} GetSymLoc(H1,X1,Y1); {Get the location of the PIO instance} Locus(0,0); {Draw a locus at the center of the PIO Instance. PIOs have their own internal coodinates} X2:=0; {Set the point to measure from. These two lines can be changed to allow measureing} Y2:=0; {From a different point. Perhaps a named locus would be best} Dist:=Distance(X1,Y1,X2,Y2);{Get the distance as a number} S2:=Num2StrF(Dist); {Convert the numerical distance into a string using the current document unit settings} FillPat(0); {Set the text to no fill} TextJust(2); {Set the text justification to center} TextVerticalAlign(2); {Set the vertical justification to top baseline so above the insertion point} Message(Date(2,2),' ',GetLScale(GetLayer(H1)), ' ',Num2StrF(GetLScale(GetLayer(H1)))); TextOrigin(pControlPoint01X,pControlPoint01Y); {Set the text origin point to use the ControlPoint values} CreateText(S2); {Create the text block showing the distance} PopAttrs; {restore the original drawing settings we might have changed} End; Run(DistanceFrom); Distance from (0,0).vso 2 Quote Link to comment
callum.adams11 Posted April 15, 2017 Author Share Posted April 15, 2017 2 hours ago, Pat Stanford said: OK, try this. I am including both the script for a PIO and the vso file. If you use the script, you will need to us the Plug-in editor and make a new Point object. It needs a single Parameter of type Control Point. By changing the defaults before inserting "Distance From" objects, you can control the initial placement of the text from the locus point. This object inserts a locus point a the point clicked (it takes a double click because VW objects are intended to be able to be rotated on insertion. Better to insert vertically and then rotate is necessary. I then adds a text block showing the distance from the origin (0,0) point of the file in the current document units. Let me know if this does or does not fit your needs. Procedure DistanceFrom; {©2017, Patrick Stanford, pat@coviana.com Licensed under the LGPL} {No Warranty Expressed or Implied. Test thoroughly before using on production data} {Make a backup copy before running} {May change data in hidden but selected objects in groups, symbols, etc.} {Do no operate heavy machinery while using. May cause drowsiness} {Lightly commented for use in learning VectoScript} {Puts a locus and a text block showing the distance from the origin (0,0) of the drawing at the location double clicked.} {Second click is necessary to account for the rotation input of PIOs. While the PIO may be rotated on insertion,} {the control point for moving the text block does not work properly on those instances. If the PIO is inserted "vertical"} {and the rotated, the control points continue to work. This appears to be plane related.} Var X1,Y1,X2,Y2, Dist: Real; {X1,Y1 are location of PIO object, X2,Y2 are the point it measures from} S1, S2: String; {S1 is the name of the PIO, S2 is the string used to display the distance} H1, H2, H3: Handle; {H1 is the handle to the PIO instance. H2 and H3 are used by GetCustomObjectInfo} B1: Boolean; {B1 is a dummy boolean required for the return data of GetCustomObjectInfo} Begin PushAttrs; {save drawing settings so the changes we make don't effect drawing environment} B1:=GetCustomObjectInfo(S1, H1, H2, H3); {Get info (name and handle) to the PIO instance} GetSymLoc(H1,X1,Y1); {Get the location of the PIO instance} Locus(0,0); {Draw a locus at the center of the PIO Instance. PIOs have their own internal coodinates} X2:=0; {Set the point to measure from. These two lines can be changed to allow measureing} Y2:=0; {From a different point. Perhaps a named locus would be best} Dist:=Distance(X1,Y1,X2,Y2);{Get the distance as a number} S2:=Num2StrF(Dist); {Convert the numerical distance into a string using the current document unit settings} FillPat(0); {Set the text to no fill} TextJust(2); {Set the text justification to center} TextVerticalAlign(2); {Set the vertical justification to top baseline so above the insertion point} Message(Date(2,2),' ',GetLScale(GetLayer(H1)), ' ',Num2StrF(GetLScale(GetLayer(H1)))); TextOrigin(pControlPoint01X,pControlPoint01Y); {Set the text origin point to use the ControlPoint values} CreateText(S2); {Create the text block showing the distance} PopAttrs; {restore the original drawing settings we might have changed} End; Run(DistanceFrom); Distance from (0,0).vso Wow, thanks!! And for the icing on the cake.. is there a way to merge it with a symbol I've created? So that the placing the plugin will place the text and the symbol? Thanks again Pat! Quote Link to comment
Pat Stanford Posted April 15, 2017 Share Posted April 15, 2017 If you want to include your symbol in the PIO, add the following line: Symbol('Symbol-1',0,0,0); With 'Symbol-1' replaced with your symbol name (in single quotes). My recommendation is to add this line right after the Locus(0,0) line. If your symbol has a different insertion point, change the first two zeros to whatever offset you need. The last one is for rotation, the first two are the X and Y insertion points. The Distance PIO does not operate properly inside of a symbol, but it should be able to be rewritten to work that way also. Then you could add the distance into your symbol instead of the other way around. 1 Quote Link to comment
callum.adams11 Posted April 15, 2017 Author Share Posted April 15, 2017 5 hours ago, Pat Stanford said: If you want to include your symbol in the PIO, add the following line: Symbol('Symbol-1',0,0,0); With 'Symbol-1' replaced with your symbol name (in single quotes). My recommendation is to add this line right after the Locus(0,0) line. If your symbol has a different insertion point, change the first two zeros to whatever offset you need. The last one is for rotation, the first two are the X and Y insertion points. The Distance PIO does not operate properly inside of a symbol, but it should be able to be rewritten to work that way also. Then you could add the distance into your symbol instead of the other way around. Perfect! I see you talk about referencing a 'named locus' as the measure from point. Is there a way to make the 0, 0 of a sheet layer that is different to the design layers as that locus? Thanks again Pat, this has been a HUGE help! Quote Link to comment
Pat Stanford Posted April 15, 2017 Share Posted April 15, 2017 If you replace the two lines setting X2 and Y2 with: GetLocPt(GetObject('PTS_(0,0)'),X2,Y2); Then the distances measured will be from a locus point that is named PTS_(0,0). You can change the name to whatever you want. If you want to use a symbols insertion point instead of a locus point, change the GetLocPt to GetSymLoc. The symbol instance will need to have a name assigned. 1 Quote Link to comment
callum.adams11 Posted April 18, 2017 Author Share Posted April 18, 2017 On 4/16/2017 at 1:07 AM, Pat Stanford said: If you replace the two lines setting X2 and Y2 with: GetLocPt(GetObject('PTS_(0,0)'),X2,Y2); Then the distances measured will be from a locus point that is named PTS_(0,0). You can change the name to whatever you want. If you want to use a symbols insertion point instead of a locus point, change the GetLocPt to GetSymLoc. The symbol instance will need to have a name assigned. Hi Pat, This has been a huge help. I was wondering if you knew anyway to automate this a bit more, having it insert symbols at x, y coordinates from a worksheet? This has saved me hours, but if I can automate it, days could be saved! haha Again, thank you so much for your help! Callum Quote Link to comment
Pat Stanford Posted April 19, 2017 Share Posted April 19, 2017 Yes, something like that could certainly be written, but to save you days will probably take me the better part of a day. Is it worth anything to you to be able to save that time? 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.