Jump to content

Pat Stanford

Moderator
  • Content Count

    5,264
  • Joined

  • Last visited

Everything posted by Pat Stanford

  1. Pat Stanford

    Export to Sketchup - weird lines

    If you were bringing something into Vectorworks and it did this I would say that Cubic Spline Smoothing was turned on. I don't know enough about Sketchup to know it there are smoothing options or not.
  2. Pat Stanford

    set shadow by class

    SetDropShadowByCls( h:HANDLE; byClassValue:BOOLEAN) ; Sets the check box for Use Class Drop Shadow in VW2019, but there seems to be a bug as the shadow does not actually display until you hit the Edit Shadow button in the OIP. I have tried the usual tricks of ResetObject and RedrawAll, but none of them cause the shadow to draw until you click the Edit Shadow button. It does not even matter if you click OK, as long as the dialog opens, the shadow draws when it closes.
  3. Pat Stanford

    Worksheets and material pricing

    Thanks @Peter Vandewalle I thought I was going to have to search the archives for this 😉
  4. Pat Stanford

    Worksheets and material pricing

    If you have a small number of options you could use nested IF statements to look up the price per unit in either the same worksheet or a different worksheet. =IF(Object.Material='Plexi',$B$3,IF(Object.Material='Cloth',$B$4,IF(Object.Material='Wood',$B$5,'Unknown Material') Where Object.Material is the record.field that holds the material data. If you already have it in a worksheet/database cell you could just reference the cell also. If you have too any options for a set of nested IFs (more than 3 or 4), then a Worksheet Script could be created that would read data, probably easiest form a separate worksheet of prices. You would pass the script the name of the worksheet, the column with the reference value and the column with the data to return. That way you would only have to keep the data up to date in one place. The down side being that the data would not be stored with the object and you could not easily overwrite the value for a single object. Ask again if you need more help.
  5. Pat Stanford

    vs. AddSurface in this situation??

    Like I said, someone else will have to help with Python syntax 😉
  6. You are correct that it does not seem to work when using Multi-view. Can you click on the Bug Submit link at the bottom of the page and report it?
  7. Pat Stanford

    Finding objects within a perimeter

    LOC only works for 2D objects (polys, rects, ovals, etc.) and spaces as far as I know. It does not work for Groups or 3D objects (other than spaces) or other PIOs (there are probably some exceptions, but I don't know them.) But it does work even when the objects are INSIDE of groups. So you can't set the Group to be TMP, but you can enter the group, name the big poly and then exit the group and LOC will still work. Does that help?
  8. Pat Stanford

    vs. AddSurface in this situation??

    Nice work. I thought I had responded last week, but it ended up sitting as a draft. You ended up exactly what I was going to recommend. Add 2 then add Repeat add 1 to the result. You might need to add some error checking. The manual for AddSurface says it only works with overlapping objects. You could get a nil handle for the added object if they don't overlap. Good Job!
  9. Pat Stanford

    Use marionette to create parameters on object

    Ask as you have more questions. I can help with the VS calls to use. The Python syntax will have to be someone else. Regards, Pat
  10. Pat Stanford

    Call "Export to Vectorworks 201x" from VS?

    In the English (American) version DoMenuTextByName('Export Previous File Version',1); DoMenuTextByName('Export Previous File Version',1); Exports a 2018 file from a 2019 document. Increment the 1 for older versions. I don't know if you need to use localized strings for the chunk name or not.
  11. Pat Stanford

    Finding objects within a perimeter

    Give them both separate names and use LOC Is Within Big Poly & LOC is Not Within Little Poly? But I don't think that will get you an object the partially overlaps the small poly. You will probably have to manually compare the bounding boxes of the small poly to each object inside the large poly to check for overlap.
  12. Pat Stanford

    Use marionette to create parameters on object

    Yes, Anything you can do in VS you can also do in Pythonscript. In Pythonscript you can actually do more. I just personally dislike the white space as delimiter notion of Python. Makes it very hard for me to debug. Yes you can get and set vetches of mesh objects with Python. You need a handle to the mesh, an index to the vertex you want to move, and just pad the X/Y/X positions you want it to take.
  13. Pat Stanford

    Use marionette to create parameters on object

    Yes, you can use Marionette for this, but this is the type of thing that I think Vectorscript (VS) is better at than Marionette. Many of the things you have listed above are a single line of code in VS once you get a couple of 10-20 line "wrappers" that you can basically reuse. In Marionette since everything is a node, you end up having to add a lot of extra nodes to do some of these things. It will also depend on more explicitly what you are trying to do. If you want to operate on a single selected object that will be much easier than if you want to operate on multiple objects in the drawing. The Marionette Gurus and I have a friendly ongoing debate about Marionette vs VS. What type of object are you talking about with a Face Size? Give us a little better description of what you want to do and we can offer better recommendations.
  14. Pat Stanford

    Replacing extruded shape with 3D symbol

    Not easily. It appears that the Racks in the Objects-Ent Stage:Rack Cases.vewx are all individual symbols rather than being a plugin object (PIO). That means that you will not be able to easily modify the size. If I am missing a PIO that generates a case, then you could theoretically write a script that would get the dimensions and center point of your extrude, delete it, and them place a PIO at that location and set the parameters for the size. You could theoretically do this with the symbols, but you would have to go through the list and pick the ones that are closest to your dimensions which many not be close enough for your needs. If you have not scripted before there is a pretty steep learning curve. As in 5 to 10 hours or more. It will depend entirely on your programming experience and how many bells and whistles you need. Make sure you really define the problem with all of the exceptions before you start trying to write it. Hopefully someone else has a better answer. If you decide to go with a script I will be glad to try and help. Just ask again.
  15. Pat Stanford

    Need help creating a Z Rotation script

    ForEachObject handles the Handles for you. 😉 Notice the definition of Callback(H1:Handle); What this means is that the procedure has to be passed the handle to an object to be able to run. So if your were going to "manually" call the procedure you would have to do something like Callback(HandletoMyObject); or else you would get an error. Internally that is exactly what ForEachObject does. It makes a list of the handles of all the objects that match the criteria and then it calls Callback one time for each object passing the handle to the object as a parameter. So at the top of Callback H1 will contain the handle to the object passed by ForEachObject. The fact that you redefine what that handle points to does not matter to the code. It just knows that it called Callback with the handles it was supposed to use. Clear?
  16. Pat Stanford

    Need help creating a Z Rotation script

    Hi @EBV_Nick The SetDSelect is ingenious, but not the solution I had in mind. I would have just removed the FSActLayer. ForEachObject passes the handle to the object to process to Callback, so H1 already has the object to process so you don't need to assign the variable. What you have now works great with the criteria we are using, but would fail if you changed the criteria to be objects that are not Visible and Selected. [VSEL] or even if they are visible and selected but not on the active layer. Glad I was able to help. Ask again if things are not clear.
  17. Pat Stanford

    Publish to print messes up the order

    The order you are stating sounds strange, but that definitely sounds like a Text sorting versus Numeric sorting problem. The field you are using is probably stored as Text. That way if you need sheet 3A you can have it rather than just numbers. But when you have a Text field it sorts using alphabetic (ASCII) sorting rather than numeric. So it sorts by the first character, then by the second character, then the third, etc. So you get something like: 1, 10, 11, 2, 3, 4, 47, 48, 5 .... The traditional work around for this is to use leading zeros so that all of the numbers are the same number of characters. 01, 02, 03, 04, 05, 10, 11, 47, 48. If you need more than 99 sheet you need to pad to 3 characters, 001, 002, 010, 011, etc. But send Nikolay a movie anyway so he can make sure there is not another bug hiding here.
  18. Pat Stanford

    Need help creating a Z Rotation script

    There are lots of different ways to loop through multiple objects in a VW drawing and then do something to them. You can use a Repeat...Until loop (executes 1 or more times) or a While loop (executes zero or more times). But in these cases you have to manually change the handle to point to the next object you want to process. I think in this case we are going to start with a different looping mechanism that hides most of the Handle handling and uses Criteria to define what objects to process. The command we are going to use is ForEachObject. ForEachObject( callback:PROCEDURE; c:CRITERIA) a ForEach Object runs a subprogram (a procedure that takes a Handle to the object to process) one time for each object in the drawing that matches the Criteria. Criteria are a way of specifying what objects to handle. You can use multiple criteria like Layer, Class, Object Type, Selection State, Records attached. Record.Field values that match or don't match a given value. So what we are going to do is take the script you have written above, convert it into the Procedure needed fro the ForEach Object procedure and set the criteria to what you need. A user Procedure or Function is just a sub-program written in the script. It starts with a Procedure (or Function) line just like the main script and ends with an End; It does not get a separate RUN() line like the main script because it is called from within the script. The following is an outline of how a script with user written Procedure would look like: Procedure Main_Script; Var {Enter the names and types of any global variables you need in the script here.} {Variables must be declared in VS} Procedure Callback(H1:Handle); {This defines the name of the procedure and says it needs to be passed a single Handle to run} Var {Local variables go here} Begin {Enter the code to do what the procedure needs to do here.} End; Begin {This is the beginning of the code for the main script} {Do what needs to be done.} {the curly braces signify comments, but you already knew that} {the indentation above is not necessary, but I like it and think it makes it} {easier to read.} End; {end of the script code} Run(Main_Script} Now an exercise for the user: Take the script posted by @EBV_Nick above and make it into a user procedure using the template above. The body of the main script will be a single line: ForEachObject(Callback,(((VSEL=TRUE) & (PON='Lighting Device')))); This criteria limits the actions to a visible selected lighting devices. We can change the criteria later to handle more objects after we are certain the script is doing what we want it to do. Ready, Steady, GO!!
  19. Pat Stanford

    Need help creating a Z Rotation script

    Answering the simple questions first: HAngle is a Vectorscript (VS) Function (a subroutine that returns a value when it finishes. it must be assigned [:=] to a variable to accept the return value) that takes a Handle (H) [Handle: a numerical pointer to an object in a drawing file. Can change when the file is closed and reopened]. There are a series of functions for inquiring about objects that you can reference by a Handle. SetRField is a VS Procedure ( a subroutine that does NOT return a value when it finishes. It can change things during execution, but does not have to be assigned to a variable.) It is an abbreviation for Set Record Field. Records are a type of database in VW. Each Record Definition consists of one or more Fields. SetRField is used to store a value into a Record.Field combination. You must know the name of both the Record and Field. PlugIn Objects have what is called the Parameter Record (that used the name of the PIO as the Record Name) that stores all the data you can enter in the OIP (Object Info Palette) (or the Settings dialog boxes) about the object.
  20. This is the latest version of a script that is discussed in several other threads. This script creates a worksheet listing all of the possible fields of the first selected PIO on the active layer. It does not work on objects in walls, you will have to put a sample object directly on the layer. The text in column B is exactly what needs to be pasted into a database header cell (preceeded by an equals sign "=") to put the formula into that column. This version has been modified to individually quote the record name and field name so names with spaces will work properly. It also now display the default field name if not localized name is available. A menu item version (put it in your user datafolder (see below)) is available for download at: http://vectortasks.com/VWFreebies/VWFreebies.html Pat (***** Copy script from here down & paste into a VS Editor window ******) Procedure GetPIORecordFields; {Creates a worksheet showing the display and field names} {for the first selected object on the active layer} {Useful for determining the record.field names required} {for use in a worksheet.} {January 30, 2008} {? 2008, Coviana, Inc - Pat Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} {Modified 8/19/08 Pat Stanford} {Now puts quotes around both record and field instead of both combined} {Modified 8/19/08 Pat Stanford} {Now displays non-localized field names if no localization} Var H1 ,H2 :Handle; S1,S2,S3,S4,S5 :String; N1,N2 :Integer; WSH :Handle; B1 :Boolean; Begin H1:=FSActLayer; H2:=GetRecord(H1,NumRecords(H1)); {get a handle to the first record} If H2 <> Nil then Begin {If a record exists then create worksheet} S1:=GetName(H2); N1:=NumFields(H2); N2:=1; S3:=''; WSH:=CreateWS(Concat(S1,' ',Date(2,1)),N1+2,2); SetWSPlacement(WSH,200,200,800,700); SetWSColumnWidth(WSH,1,1,200); SetWSColumnWidth(WSH,2,2,200); SetWSCellFormula(WSH,1,1,1,1,Concat('Parameter Fields for PIO: ',S1)); SetWSCellFormula(WSH,3,1,3,1,'Display Name'); SetWSCellFormula(WSH,3,2,3,2,'Cell Formula'); While N2<=N1 Do Begin {populate the worksheet with all the fields} S2:=GetFldName(H2,N2); S3:=Concat(Chr(39),S1,CHR(39),'.',CHR(39),S2,Chr(39)); SetWSCellFormula(WSH,N2+3,2,N2+3,2,S3); B1:=GetLocalizedPluginParameter(S1,S2,S4); if S4='' then S5:=S2 else S5:=S4; SetWSCellFormula(WSH,N2+3,1,N2+3,1,S5); N2:=N2+1; end; ShowWS(WSH,True); SetTopVisibleWS(WSH); end; End; Run(GetPIORecordFields); (***** Stop copying here *****)
  21. Do you intend to have the viewport in perspective view? If not set the Projection to Orthogonal and the frame corners will go away. I have not tried using multiple view panes. Maybe later.
  22. I just tried in VW2018 and get the same abilities as in VW2019. I think this has been around since the introduction of Viewports. VW2012? I don't know why it is not working for you. For Section Viewports, if you put a Crop Object in the crop group, then it will not move on the sheet layer. If you go to the design layer and move or resize the Section Marker, what is in the Crop will move to follow the Marker. Not the best option, but better than trial and error.
  23. Let me see what I can do over the weekend. This could be fun!
  24. Pat Stanford

    Listing layer name in worksheet

    If you need the text shortening, then the only option is a script. The worksheet text handling is not strong enough to do what you want. It could be a worksheet script, but then there are issues with distributing the script to multiple people. But that is a different discussion. Another possibility would be to use a Data Tag. You can create a data tag that will return the layer that the tag is on. I have not figured out how to get that data into a worksheet yet. Longer term, I agree with @Nikolay Zhelyazkov that you should consider turning your title block in to a Title Block Border object. It will help out a lot in the long term. You should probably also take a close work at your workflow and determine if using viewports and sheet layers would not be a better solution that your strictly design layer (??? at least that is what I have gotten from your posts) current workflow.

 

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.

×