Jump to content

Pat Stanford

  • Content Count

  • Joined

  • Last visited

Everything posted by Pat Stanford

  1. Pat Stanford

    Script to toggle class + layer on and off

    Thanks @twk I was being lazy and hoped to not have to switch the active layer to be able to use the Show/Hide/GrayLayer options. Good catch, but I am a little surprised that the Show/Hide/Grey don't do exactly the same as the pref does under the hood.
  2. Pat Stanford

    Script to toggle class + layer on and off

    Then it must be the changing of the visibility requires project sharing access. I don't think there is anything I can do about that as the script does not specifically ask for access. It does not seem to me (with zero experience in project sharing) that you should need to own the layer to change the visibility.
  3. Pat Stanford

    Script to toggle class + layer on and off

    I have no idea why it effects project sharing. I have never used the project sharing. My guess is that it is the last line of the script Layer(GetLName(ActLayer)); {Force layer to active layer to update Nav Palette} This sets the active layer to the active layer to force a redraw of the Nav Palette. Try moving the left brace "{" to the beginning of the line to comment it out and see if that fixes the project sharing issue. As for the Message block, just delete the line that reads MEssage(DAte(2,2), LVis); This was for debugging and I missed removing it. (I have edited the script above to remove this. You could just grab it from there again instead.)
  4. Pat Stanford

    Script to toggle class + layer on and off

    Try this. Procedure Toggle; {If either layer or class specified in Consts is invisible, then sets} {both to visible. If both are visible then sets both to invsible.} {Change the LName and CName in the Const section to match your desired} {class and layer. Note code at bottom to cause proper screen and Nav} {palette updates.} {Warning: Use of this script may cause diziness. Alcohol may make this} {worse. Use care when operating a locamotive while using this script.} {If you are pregnant or considering becomeing pregnant, consult with } {CAD Manager before using this script. Self inflicted hair loss is a } {frequent side effect of learning to script. If script does not operate} {as intended, Do not pass GO, Do not collect $200. Use at your own risk.} {There be dragons. ARRRGH!} {November 12, 2018} {©2018 Patrick Stanford pat@coviana.com} {Licensed under the GNU Lesser General Public License} Const LName='1-Slab'; CName='Structural-Slab'; Var LHand : Handle; LVis, CVis : Integer; Begin LHand:=GetLayerByName(LName); LVis:=GetObjectVariableInt(LHand, 153); CVis:=GetCVis(CName); If (LVis + CVis) = 0 then {If both layer & class visible} Begin SetObjectVariableInt(LHand, 153, -1); {Layer to invisible} ResetObject(LHand); HideClass(CName); {Class to invisibile} End Else Begin SetObjectVariableInt(LHand, 153, 0); {Layer to visible} ResetObject(LHand); ShowClass(CName); {Class to visible} End; RedrawAll; {For redraw to show hide objects with changed vis} Layer(GetLName(ActLayer)); {Force layer to active layer to update Nav Palette} End; Run(Toggle);
  5. Pat Stanford

    Strip Text From Worksheet

    Try Value(SubString(Cell Reference Containing Text Data, Delimiter, Position)) If B3 Contains 93lbs, the cell containing =Value(Substring(B3, 'lbs', 1)) Should display as 93 formatted as whatever number type you want.
  6. Pat Stanford

    3D Views in 2019

    Is the object just off screen after you switch the view? If you have the extrude selected before you switch view try Fit to Objects and see if it shows up. Or zoom way out until it shows up. And then back in on it. There is also an option in VW Preferences, Display Pane to Center on Objects after View Change. This might solve you problem as well.
  7. You can still do what I suggested, you just have to know the Field Name you are want. Right Click on the Database (i.e. 3, not 3.1, etc) and choose Edit Criteria. Click Cancel. In the Formula Bar you will now have a text representation of the Criteria for the database. Click into the Formula Bar and find the 'Record'.'Field' portion of the criteria and edit those values to be what you want. Hit Return to lock in the edited criteria. I THINK that as long as what you edit them to is something the criteria builder can display you can still edit the criteria the next time using the Criteria Builder dialog box. I know it is possible to create criteria that are valid for a worksheet that can't be edited with the criteria builder, but I think these are mostly cases of adding extra ANDs and ORs to the criteria. I am not saying there there should not be improvements in the Criteria Builder, just trying to offer a workaround until the functionality improves
  8. Pat Stanford

    Updating Plugin Pop-Up Choices

    Without seeing the code, it is hard to say. If they are all similar and you want the same topdown list, you can probably edit each script to use a single include file that has just that portion of the code. Then you would only need to edit that one include file and recompile each script. If they are PIOs and are used multiple times in a drawing, you probably don't want to have the Alway Compile setting turned on, so you would need to open each in the Plugin Editor. I don't know of any want to automate that step. @JBenghiat, @MullinRJ, @Sam Jones Any of you have any suggestions?
  9. That is the way the Criteria Builder works. You can alternatively click into the formula bar and manually edit the criteria and type in whatever you need. But you will have to be exact in what you type.
  10. Pat Stanford

    Updating Plugin Pop-Up Choices

    It would be possible to do this with a script, but would probably be slow and difficult to get right. Since you are on a Mac, I would look at getting BBEdit and using the multi-file find and replace to do the changes that way. You will probably want to restructure your scripts to use {$INCLUDE filename} structure so that most/all of the script is stored in a plain text file rather than being stored only in the VW document. If you do this you might be better off converting the scripts to Menu Item Plugin Objects so you only have to update them once rather than in every document. You will probably also need to turn on the program switch to compile the script on every run.
  11. Pat Stanford

    Dimension parameter setting

    I can't identify the setting you have to change to get this to occur, but I can verify that the ASME, BSI, and JIS dimensions standards have the property that you want. I suggest that you put some dimensions on a page Duplicate them twice, and set one set to each of the above settings. Determine which one is closest to what you want. Go to Document Preferences, Dimensions, and set the Dimension Standard to what is closest to your liking. Click the Custom button and then from the Custom Dimensions dialog box click New. This will create a new dimension with the same settings at the standard you had chosen before you hit New. Edit the standard to work as you want, then Open you template files and Import the revised dimension standard into your template(s) so it will be available when you create a new file. You probably also need to uncheck the Arrows Inside box in the OIP for the dimension if the space inside is large enough for the markers but you want them outside.
  12. Pat Stanford


    The following thread has scripts to Scale individual objects and to Rotate Individual objects. Flip should not be a hard modification. You probably want to read the entire thread to figure out which version is best for your needs. Several of the posts have bugs in them, so always use the latest script that will work for your needs.
  13. Pat Stanford

    Dimension parameter setting

    In the Edit Custom Dimension Standard Dialog box, check the Dimensions Always Inside check box. Note that this my end up looking really bad if you try to dimensions a very small space with a large font and/or arrowhead.
  14. Pat Stanford

    duplicate object from inside group to outside group.

    Another possibility: If you put the interactive select object into the script, you could put a DSelectAll at the beginning of the script so you will know you don't have anything selected. Select the object and then use FSObject to get a handle to that object. Probably want to check the NumSelectedObjects first to make sure that you only have a single object selected. I think this will work even if you are in a group or symbol.
  15. Pat Stanford

    duplicate object from inside group to outside group.

    Let's try and phrase this a little differently. I am on a plane right now and don't have VW open, so please consider everything pseudo-code. 1. As @JBenghiat says, FSActLayer does what it says and returns the First Selected Object on the Active Layer. Being inside a group or symbol or PIO does not effect the handle returned from this function. 2. If you do If GetType(GetParent(MyObject))<>Layer, then you know that you are inside a group, symbol, PIO. You could also be in the Annotations Group or Crop Group of a viewport, or the Profile Group or Path Group of an extrude or extrude along path. Or probably inside a lot of other object types as well. You probably want to check the type of the GetParent handle to make sure you are in the type of object that you want. 3. If you already have a handle to the group, you can use FInGroup to get the first object inside the group. You will then need to use NextObj or NextSObj to step through to find the object you are interested in. If you have another way (the Name of the object perhaps) you can select it directly without having to do the NextObj step. 4. If you know you are in an object and that you have a single object selected, then the Waldo technique is probably required. Create a new object, GetLNewObject, GetParent(Last New Object), If Parent=Group, then FInGroup, NextObj until Object=Selected. Delete Waldo, Duplicate SelectedObject, SetParent to Layer. 5. Or if you are editing manually, it might be easier to just use DoMenuTextByName to do the Duplicate and see if the duplicate happens to show up as the LNewObject then you could just to SetParent on that instead. 6. Tell us more about how you are selecting the object in the group and we might be able to offer better solutions.
  16. For custom items like this @Sam Jones or @C. Andrew Dunning might be your best bet. Sam is the author of Autopilot tools for Spotlight. Very useful and inexpensive tools for lighting design. Andy is the creator of the the Staging Toolkit that at first glance seems similar to your block with visibilities idea. Hopefully my tagging them will attract their attention like sharks to chum 😉
  17. Pat Stanford

    Round kickplate not contained with LOCation

    I believe that Loc only returns objects that have the center point of the object bounding box within the named object. For Round Walls it appears that it is the center point. I just did a test and can get a round wall to be counted as part of a space even when the wall itself is outside as long as the center point is in the names object. For regular walls the critical point appears to be the center point of the wall. So to answer your question, yes, it is because the center point is outside of the object.
  18. Pat Stanford

    how do you create a worksheet of objects that are named?

    If you are typing it into a formula instead of using the criteria builder I think it would be: ((N<>'')) Those are two single quote marks to the left of the inequality. It might only need a single set of parens, but more hardly every hurt as long as they are matched.
  19. Pat Stanford


    On 10/23/2018 at 11:32 AM, mgries said: =IF('Door'.'UserFld10’<>'Custom', 'Door'.'Config', 'See Door Elevation') @Pat Stanford, Any idea why this modification to your formula doesn't work? The goal is to simply write the word "Custom" into a designated user field, and then use this bit of data to overwrite any of the record fields. It's not working however. Do you know what I'm doing wrong here? My guess is that you need parentheses around the criteria. Try: =IF(('Door'.'UserFld10’<>'Custom'), 'Door'.'Config', 'See Door Elevation') If that does not work try adding a second set of parentheses. I have found that the interpereter seems to have trouble if you don't get the parens correct, but I have not found a definitive source for how it works or what the parens should be. It is probably not properly parsing the <> and so not getting a single True/False value in the criteria part of the IF statement. Not tested as I don't have VW open right now.
  20. Pat Stanford

    Isolate/Hide Object

    Thanks Kevin, Check out these threads. They can do almost everything @Mark666 is asking for except the Red exclamation point to show that things are hidden.
  21. 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.
  22. 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.
  23. 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.
  24. Pat Stanford


    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.
  25. Pat Stanford


    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.


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.