Jump to content

Pat Stanford

Moderator
  • Content Count

    5,025
  • Joined

  • Last visited

Everything posted by Pat Stanford

  1. Pat Stanford

    Select a random assortment of objects?

    Here is the script from my last version. You can use this to create a PIO in an earlier version. Create a new PIO of type Command. It needs a single parameter named NumGroups of Type Integer and my default value of 3. Copy and Paste the script below into the Script of the command. and then add the command to your workspace. Procedure RandomGroups; {April 29, 2018} {© 2018 Patrick Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} {No warranty expessed or implied. Use at your own risk.} {Backup your data prior to use. Do not use on your only copy of a file.} {Test thoroughly to ensure suitability to your purpose.} {Do not sit in the passenger seat while driving your Tesla while} {Running this script. May cause drowsiness. Do not operate heavy equipment} {or drive a vehical or bicycle while using this script. Use of this script} {with alcohol, prescription, or other drugs may cause unpredictable} {results and dangerous side effects. If you develop a rash of purple spots} {with cartreuse centers develops, immediately discontinue use and seek} {medical attention.} {Plugin Menu Item to assign selected objects on the active layer randomly to different groups} {The number of groups can be changed by holding hte OPTION key when the menu item is selected.} {The original intent was to provide a way to take a selection of symbols and provide} {a way to change a random selection of those objects to other symbols. This can be accomplished} {by entering each group produced and replace the contained objects. When the groups are ungrouped} {you can have a mixture of different symbols in the array. May be useful for things like} {plants, trees, people in theater seats} Type RandomStruct = Structure Hand :Handle; Rand :Real; GroupNum :Integer; End; Var A1 :Array[1..3822] of Handle; GroupArray :Array[1..11] of Handle; ObjArray :DynArray of RandomStruct; NumObjects :Integer; NumGroups :Integer; N1, N2, N3 :Integer; H1 :Handle; R1,R2 :Real; B1 :Boolean; ObjName :String; RecHand :Handle; L1 :LongInt; Begin NumGroups:=pNumGroups; {Set parameter for number of groups to a variable so it can be changed during run} {If Option key held down at menu selection then ask for number of groups} If Not AUTOKEY(L1) AND OPTION then Begin N3:=IntDialog('Enter Number of Groups (Max. 10)',Num2Str(0,NumGroups)); NumGroups:=Min(N3,10); End; {If the number of groups has changed, save that back to the parameter for the next run} If NumGroups <> pNumGroups then Begin B1:=GetPlugInInfo(ObjName, RecHand); SetRField(GetObject(ObjName), GetName(RecHand), 'NumGroups', Num2Str(0, NumGroups)); End; H1:=FSActLayer; {Get a Handle to the first selected object on the active layer} NumObjects := NumSObj(ActLayer); {Get the total number of selected objects on the active layer} Allocate ObjArray[1..NumObjects]; {Set the array size to handle the number of objects} R1:= 1/NumGroups; {Caclulate the percentage of objects to be in each group} {Store a handle to each selected object, a random number, and a group based on the random number into the object array} For N1:=1 to NumObjects do Begin ObjArray[N1].Hand:=H1; ObjArray[N1].Rand:=Random; ObjArray[N1].GroupNum:=(1+Trunc(ObjArray[N1].Rand/R1)); If ObjArray[N1].GroupNum > NumGroups then ObjArray[N1].GroupNum:=NumGroups;{Special case of random = 1} H1:=NextSObj(H1); {Move to next selected object} End; {Create groups and store the handle to each group in the group array} For N2:=1 to NumGroups do Begin BeginGroup; Locus(0,0); {Since a group can't be empty put a locus as a placeholder. Delete later} EndGroup; GroupArray[N2]:=LNewObj; End; {Iterate through groups to add objects to proper group} For N2:= 1 to NumGroups do Begin {If an object's group number matches the group array index, add that object into the group} For N1:=1 to NumObjects do Begin {SetParent is used to set the parent of the object as the group with the proper group index} If ObjArray[N1].GroupNum = N2 then B1:=SetParent(ObjArray[N1].Hand,GroupArray[N2]); End; End; {Iterate trhough groups to remove placeholder loci} For N2:= 1 to NumGroups do Begin If GetType(FInGroup(GroupArray[N2]))=17 then Begin DelObject(FinGroup(GroupArray[N2])); End; ResetBBox(GroupArray[N2]); {Reset the bounding box that was set to only the loci to put handles correctly for all contained objects} End; RedrawAll; {Force a redraw of the screen to properly display the new groups} End; Run(RandomGroups); Per @LJ TMS above, the Option Key trick (probably ALT on Windows) might not work on something other than a Mac, but that is all I have to test on. Thanks for the fix.
  2. Pat Stanford

    New layers script + date + separation layer.

    The script looks great. You might want to put in some comments so you can figure out how it worked in 6 months. Another idea. When you are editing a post, you will see the <> in the menu bar at the top of the edit screen. This is for entering code and have it located in a separate block. The nicest thing about this is that is understands indentation and does nor force everything to be left aligned. If I take a snippet from your code above LayH:= Concat(newname, '_8_Frei'); IF NOT DidCancel THEN BEGIN ch:= GetObject(LayH); IF (ch = NIL) THEN TextoAlert:= Concat(Texto1, LayH, Texto2); Layer(LayH) END ELSE AlrtDialog('Layer name already exists.'); I would indent it something like as follows to make it easier to read. Code blocks let that happen. LayH:= Concat(newname, '_8_Frei'); IF NOT DidCancel THEN BEGIN ch:= GetObject(LayH); IF (ch = NIL) THEN TextoAlert:= Concat(Texto1, LayH, Texto2); Layer(LayH) END ELSE AlrtDialog('Layer name already exists.'); Note that I put the begin on a new line rather than after the THEN. I like to keep my BEGINS and ENDS at the same indentation. For me this makes it much easier to figure out the code. And my putting it in a code block, all you have to do is tell someone to select everything in the Code block and copy. Many times someone will forget to copy the Procedure line or the Run line and then want to know why the script does not compile.
  3. It is just how records are attached to symbols. The symbol is not the "object", so if you replace the symbol, the "object" and any records attached are not changed. When a symbol definition has a record attached, and that symbol is inserted into the drawing you get a symbol instance with an instance of the record attached that contains all of the data from the record attached to the symbol definition. The record attached to the symbol is then no linked in any way to the record attached to the symbol definition. So when you insert the first symbol, the instance gets an instance of the first record attached. When you replace the first symbol with the second, you get the second symbol plus an instance of the second recorder attached to the "object". The first record is still attached to the "object" that is having the symbol replaced. So now the "object" has both records attached.
  4. Pat Stanford

    WORKSHEET CREATION

    Did you get this figured out? I get that message when I try to edit a dimension using door.doorheight in the header. If I use door.height in the header it is editable and does change the door on the drawing.
  5. Pat Stanford

    WORKSHEET CREATION

    Michael is correct that this is a good use of an IF statement. Something like =IF('Door'.'Config'<>'Cased Opening', 'Door'.'Config', 'See Door Elevation') Have you considered using or do you use the Use Symbol Geometry option for these custom doors? That way it is only a Door in Wall and moves like everything thing else. You may still need the IF to get the schedule to display as you want.
  6. There are many ways to customize Vectorworks to better fit your needs. You can script in VectorScript or in PythonScript. You can create a Marionette network. You can create a custom worksheet. What you have not been able to do until now is find an in-person place to interact with others also interested in customizing VW. Michael Klaers and Pat Stanford (all around Good Dudes™ and frequent posters on the forum) would like to change that. But we need to judge if there is sufficient interest to make it worth our time to do the organizing. We have posted a short survey. 10 questions. You can answer them all in less than 2 minutes. Give us 10 minutes and you can have massive input into the event. We are truly interested in your responses, regardless of if you like the idea or not, we would like to get your feedback so we can see a broad cross section of users. The survey is posted at https://www.supersimplesurvey.com/survey/20404/conference-interest No personal information is required. We won't spam you. We just have this idea and want to see if others are with us. Thanks in advance. We hope the interest exists and we will see you at the first annual Customization Conference.
  7. Pat Stanford

    adding notes to dimensions

    I don't think so. I believe there is only one text size for all aspects of a single dimension object. You could make the note a separate text object with a different text size and then GROUP the dim and text together so they stay together if moved. You would have to edit the group if you need to make a change to the dimension.
  8. Pat Stanford

    pulley & belt system

    Pulleys come in stock sizes, Belts come in standard lengths. In a 3 pulley setup as shown, at least one of the pulleys has to be adjustable so that you can loosen it to remove an old belt and put on a new belt. 2D version of Shrink Wrap would be the Lasso mode of the polygon tool. It will have to be redone when you change the pulley locations. Set the Tangent snap on and draw lines between your three pulleys. Select the Lasso mode of the Polygon tool and draw a "fence" completely around the three pulleys. You will get a new polygon created that is the interior portion of the pulleys and the lines. You can extract the perimeter from the OIP. I tried to use the Tangent constraints, put they don't seem to work properly when I move the pulleys. You could write a script that would do this. My rough estimate is that it would take me about 4 hours to write and debug this. 1. I don't have 4 extra hours in my life right now. 2. It would take someone without lots of scripting experience 2-10 times longer to write the script. 3. How many times are you really going to have to move the pulleys and how much time are you really going to save by having a "faster" way to do this?
  9. Pat Stanford

    Symbol count report, segmented by room / area ?

    Loc does not take a criteria, but rather the name of an object. I think it has to be the name that shows at the bottom of the OIP. I don't know if the SpaceName will work or not. Loc('OIP_Name_of_My_Space') should get you what you are looking for.
  10. Pat Stanford

    dialog handler

    Three code changes to get it to compile and execute. SetLineStyleChoice -> SetLineTypeChoice GetLineStyleChoice -> GetLineTypeChoice SetWSCellOutlineBorder -> SetWSCellOutlineBN And one bad bug that prevents it from running. It appears that the GetWSSelection command is returning bad values for the subrows. The following very simple script gives the same runtime error as yours. Procedure Test; Var WSHand:Handle; currentCellRow,currentCellColumn,topRangeRow,leftRangeColumn,topRangeSubrow,bottomRangeRow,rightRangeColumn,bottomRangeSubrow:Integer; Begin WSHand:=GetTopVisibleWS; GetWSSelection(WSHand,currentCellRow,currentCellColumn,topRangeRow,leftRangeColumn,topRangeSubrow,bottomRangeRow,rightRangeColumn,bottomRangeSubrow); Message(currentCellRow,' ',currentCellColumn); End; Run(Test); Procedure Test; Var WSHand:Handle; currentCellRow,currentCellColumn,topRangeRow,leftRangeColumn,topRangeSubrow,bottomRangeRow,rightRangeColumn,bottomRangeSubrow:Integer; Begin WSHand:=GetTopVisibleWS; GetWSSelection(WSHand,currentCellRow,currentCellColumn,topRangeRow,leftRangeColumn,topRangeSubrow,bottomRangeRow,rightRangeColumn,bottomRangeSubrow); Message(currentCellRow,' ',currentCellColumn); End; Run(Test); Until VW fixes the bug in GetWSSelection, you are out of luck on this script. Everyone knows that debugging is twice as hard as writing a program in the first place. So if you're as clever as you can be when you write it, how will you ever debug it? Brian Kernaghan"The Elements of Programming Style", 2nd edition, chapter 2.
  11. Pat Stanford

    Symbol count report, segmented by room / area ?

    Can you post a simple file with a couple of spaces and a few different symbols in each space. I will see if I can make it work so you can see exactly what is required in your file.
  12. Pat Stanford

    Worksheet Flow to Multiple Panes

    You got the best/only current way to do this. You might want to enter a wish list request for this feature. The more they see the request the more likely it is to happen.
  13. Pat Stanford

    Assign "Fixed" data to a symbol

    I think the Sum Values is just how it works. If you check Sum Values for a column it will use the SUMmed values when doing calculations if you don't check Sum Value it will use just the single value for that cell. Since you have to use Sum Values for everything and you are trying to use a single value minus a summed value, I think you will have to get creative. If you post a simple file with some objects I will try it here, but I think the following will work. But it will only work if the available quantity is the same for every instance of the symbol. =Record.Available/Count-Count with Sum Values checked I THINK will get you what you want. Or not. I thought I got it to work once, but not can't replicate. The issue appears to be that you want to use something that is SumValues and something that is not SumValues in the same cell. Should be possible, but I have not cracked it yet.
  14. Pat Stanford

    Lighting Accessory tool question

    Answered in the other thread. For those to lazy 😉 to check it out, the field is formatted as text instead as a number. Hard to do math on text.
  15. Pat Stanford

    Worksheet Column Total

    'Lighting Device'.'Clamps' is formatted as a text field instead of a number field. Either change the field type to a number format or use a formula in column A of =Value('Lighting Device'.'Clamps') so you have numbers that can be summed.
  16. Pat Stanford

    Disappearing Objects in Symbols

    Are your "2D" objects screen plane? The naming convention has not caught up with the progress yet. The 2D portion of a symbol is actually the Screen Plane portion of the symbol The 3D portion of a symbol contains everything else, including Layer Plane and Working Plane Objects. Or maybe I am talking through my hat. I know it used to be this way. I have not hat time to play with the new multi view hybrid objects in VW2019.
  17. Pat Stanford

    Transforming Viewports into vector drawings

    Set your drawing window to the aspect ration you need for the manual, Zoom In, and then Export PDF - Current View Only?
  18. I was near the computer, but I have been on 7 conference calls and a lunch meeting today. Hard to script with all that background rigmarole going on 😉 Michaels explanation of the code block being in the forum was exactly what I meant.
  19. I always try to past scripts into a "code" block (click on the <> icon above the edit window). That will ensure that everything is truly text and not some extended unicode text like object. It also keeps tab formatting correct rather than compressing everything to the left margin. My question would be what browser you are each using and what operating system. I know Michael is on Mac and it looks like Boh is on Windows. My guess is that whatever browser Boh is using is sticking some invisible characters into the text when copied that are then confusing the VS compiler.
  20. Pat Stanford

    Assign "Fixed" data to a symbol

    Probably has to be a wish list item, but there might be some possible work arounds. 1. There is currently no way (that I know of) to have a record or field permanently linked to the symbol definition. As soon as you insert a symbol instance, it gets its own copy of the record and if forever after independent. 2. Potentially the easiest solution would be a script that when run would read all the data from the record attached to the symbol definition and write that to every symbol instance. Down side is that you have to remember to run the script. 3. If you don't need to be able to see the data in the OIP, another possibility would be to create a hidden record format and attach that. You could then edit the data with a worksheet or a script. Also, you would still need the script from Option 2 as changes would not propagate to each instance. 4. It might be possible to create a PIO that could act as a "container" around a symbol and have effectively the script Option 2 included in the PIO code so that when the PIO regenerates it "grabs" the current data from the symbol definition. But you still have to remember to regenerate the PIO. 5. It might be possible to create a "master" layer that would hold a single instance of each Symbol/Record/Field. Potentially a link to the correct "master" could be stored in a record attached to the instance. With the correct (probably a worksheet script) functions, it might be possible to extract the data from the "master" rather than the instance. I understand and can see the benefit of what you are asking. Can you better explain your exact use case/need right now so we can possible offer a better solution?
  21. Pat Stanford

    UCS not on building, so flyover tool makes building shoot away

    It sounds like you have the 4th mode "Active Layer Plane Origin Mode". This will use the origin as the rotation point. You probably want the first mode "View Center Mode", or the second mode "Interactive Origin Mode". The View Center will rotate around the current view. The Interactive Origin Mode will let you click to specify the point to rotate around.
  22. That is correct. The Space object does not have an area that can be queried directly. It calculates all the different areas internally and you can them access them using the Record.Field format, but the Area (and probably Volume, and maybe the width, height, depth functions) will not return valid data for a Space object.
  23. Or any of the following depending on your needs. The ones were the field name starts with 11 return a formatted text field. The others return a number of type Real. 'Space'.'Proposed Area' 'Space'.'Area' 'Space'.'Gross Area' 'Space'.'GSA BIM Area' 'Space'.'Custom Area' 'Space'.'11_Proposed Area' 'Space'.'11_Area' 'Space'.'SubtractionArea' TEXT 'Space'.'SubtractionAreaNum' REAL 'Space'.'MeasuredNetArea' TEXT 'Space'.'MeasuredNetAreaNum' REAL 'Space'.'11_Gross Area' 'Space'.'EnergyArea' 'Space'.'EnergyAreaFac' 'Space'.'SpaceCommon_NetPlannedArea' 'Space'.'SpaceOccupancyRequirements_AreaPerOccupant' 'Space'.'SpaceThermalDesign_BoundaryAreaHeatLoss'
  24. Pat Stanford

    What is in that class?

    Worksheet Database Criteria Class IS "My Class Name". Check the In Group and InSymbol check boxes. Set Columns for: =L (gives the layer name) =T (gives the object type) =N (gives the object name if there is one) You can then right click in the row header and Select the object. It will work like Force Select and change the visibilities so the object will be visible and zoom in to show it.
  25. Pat Stanford

    Record format assigned to a symbol

    I think there is a script floating around to change record values, but I don't have time to search for it now. On an ad hoc basis, I would use a worksheet. Set the criteria to Record "My Record Name" is present. If you want to do a subset then also add an Is Selected. Create a column containing the Record.Field that you want. Edit one cell to the value you want applied to all. Select the cell and Copy. Select all the cells that you want changed. Paste. The single value will be placed into each instance of the symbol. If you want different values for the same symbol on a regular basis, then a PIO might be the best way to go as you will be able to see the value on the Shape tab of the OIP instead of having to switch to the Data tab. Actually try and see if VW will let you edit the Data Tab values if you have more than one object selected. I don't have VW open right now.

 

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.

×