Jump to content

Pat Stanford

  • Content Count

  • Joined

  • Last visited

Posts posted by Pat Stanford

  1. Left is not a valid function in a worksheet. 


    Try  SubString('Title Block Sheet Data'.'Sheet Number','-',1) to get the first part of the  sheet number.  Note that SubString works on delimiters, not on number or characters, so if someone used 'AB' in front of the first dash you would get AB back, not just the A.


    String handling in worksheets could certainly use some love.

  2. If the entire palette is missing, go to the Window menu, Palettes, and make sure the Tool Sets palette is turned on.


    If the Tool Sets palette is turned on, check that it did not get resized so small that the tools are not showing. Are there other tools besides the wall that are not showing in the Building Shell or other set?


    Try switching to a different workspace (Tools menu: Workspaces) and see if it shows there.




  3. In Marionette, any input node that you assign a Name to will show up in the OIP (Object Info Palette).  The Create Custom Object node is used to insert another PIO into a Marionette Object.


    In Python/Vectorscript you have to use the Plugin Editor to define Parameters that will display in the OIP. You then use those parameters to calculate where in the relatively space of the PIO to draw your objects. In VS/Python you use the CreateCustomObject function to insert a PIO into an object created by script.

  4. PIOs are Hybrid Objects meaning they have a 2D (screen plane) component that shows in Top/Plan and a 3D component that shows in all other views.(actually since there are now multiple 2D views that is not entirely correct, but you get the idea.


    If there are no Screen Plane objects, then the 3D portion will show in Top/Plan as a wireframe. If there are no 3D objects (layer plane or working plane) the 2D will show in all views.


    You must have some kind of 2D object in your PIO script that is making it a hybrid. Probably the same error in the code that is not doing the subtraction properly. Make sure you have Handles to the correct objects before you do the subtraction.

  5. In my opinion, making a PIO is much more complicated than making a script. You could create a script that would display a dialog box, get a value, store that in a variable and then use that to modify how the script works.  Once you have it all working OK you could then relatively easily convert that to PIO and delete the dialog boxes and convert those variables into parameters.


    There are just a lot of small details (from how you name variable/parameters to how you get into the code to edit it) that are more complicated in a PIO. If you add that level of frustration to just trying to learn to code, it will make it harder.


    Plus, if you make a PIO, you can't just post a file for us to try and help. If you only post the code from the PIO, then either we have to create the PIO (including all of the parameters and defaults), or you have to send the PIO and we have to add it to our workspace to be able to help. I personally am much less likely to help with a PIO problem than with a script problem that I can work on quickly.




  6. Once you create a PIO you have to use the Workspace Editor to add it to either a palette or a menu. You get to decide where to place it.


    I don't think VW is going to be nearly as simple as this was in TopSolid. My guess is that it is going to take you probably 10-100 times longer to make the equivalent in Marionette.


    To start, I would manually make one of the objects using all of the pieces you need. Then you can start to think about how you are going to create a Marionette to put all of those pieces into the drawing in the correct locations (parameters) to generate the final object.


    Then create a marionette to do the most basic part of the object and get that working. Then add additional parts one or a few at a time and keep moving forward.


    Marionette is the correct tool (in my opinion) for doing this in VW, but hooking up all of the parameters for 130 parameters is going to take some time. On top of the time you are going to spend learning VW and Marionette.


    Use the Create Custom Object tile to insert PIOs or the Symbol tile to insert symbols. Both are under the BIM heading.


    Good luck. Ask again as you get stuck and we will try to help.

  7. The faceting is due to your OpenGL Options being set to Low. Try setting it to high and it will be much smoother.


    Procedure Test;
    Var	H1,H2,H3,H4: Handle;  {create handles to be able to access objects}
    	N1: Integer; {create a variable to accept the result fo the subtract}
    	Rect(-10,-10,10,10);  {draw rectangle}
    	H1:=LNewObj;          {Get handle to rectangle}
    	H2:=HExtrude(H1,0,5);  {extrude rectancle}
    	Oval(-3,-3,3,3);      {draw circle}
    	H1:=LNewObj;          {get handle to circle. Not I am reusing handle variable}
    	H3:=HExtrude(H1,0,10);  {ectrude circle}
    	N1:=SubtractSolid(H2,H3,H4);  {subtract the extruded circle from the exturded rect}
    	AlrtDialog(Concat('The Result of the SubtractSolid is:',N1)); {optional: report return value of subtraction}


  8. The ForEachObject call is not passing a handle to the record, but rather to the object with the record attached. You should use a different variable name for the handle being passed to HowManyPeople. You will then need to get a handle to the record that is attached.


    You will need to do something like this to find the right record:

    While ((N2<=N1) and (Done<>true)) do
    	If RecName='My_Field_Name' then Done:=True;

    and then use RecHand in your Str2Num function.

  9. Also check out the VW Preferences, Interactive tab. There you can set the size of the Selection Box and the Snap box (as well as the color and thickness or the boxes). By making the Selection Box (inside box) smaller and the Snap Box (outside box) larger you can make it easier to snap to points without accidentally selecting those objects.

    • Like 2

  10. Trying to use VW the way you used AC will likely result in great frustration. There are just too many differences.


    You need to accept that you will need to learn to do things in the VW way.  As Mike says, Snaps are basically the same as your loci. You can set them to provide end/mid/intersections or even a random division. By hovering over an object you can see little tick marks that are the current snap points. If you grab and drag the point on an object you want to move you can then "read" the snap points and put it exactly where you want.


    You might also want to check out the help files on the Snap Box versus the Selection Box of the smart cursor. This determines how close to a snap point you have to be to get it to snap versus how close you need to be to get it to select.


    You may also want to read up on the Snap Loupe to let you temporarily zoom in to make a selection or pick a point.

  11. Joshua is correct. As always. But perhaps a little more detail will help.


    The =N returns the Name of the object. This is the name that you can type into the OIP. I think it also returns the "source" object for PIOs and Symbols. VW is very picky about names and only one object in a file can have a specific name. You can't have a class named Door in a file that has a Door object in it. 


    Your script retuned 1 because there is only 1 object with that name in the file. It is the definition of the PIO.


    PON to return the plug-in name or S to return the symbol name are usually better options for criteria.


    • Like 1

  12. 8 minutes ago, josue Corona said:

    Thank you 😄 I will try to make those changes . Just to point out, this script I did not make it, and I am still learning how to script. 

    I kind of guessed that might be the case.

    Keep asking and we will keep trying to help you out.  But response times might be longer than what you got this morning. 😉




    The above lines store the old attributes settings (Push Attrs) and set the attributes that objects drawn during the execution of the script will use.  The PopAttrs at the end of the script returns the settings to what they were before the script was run. If you really want to use the class attributes, everything from FillBack to PenPatN could be deleted.


    IF (PBuildMat = 'wood 1 x 3')|(PBuildMat = 'wood 1 x 4')|(PBuildMat = 'wood 2 x 4') THEN BEGIN
                FillFore(46529,34664,22800); {0=black}
                FillBack(46529,34664,22800); {65535=white} END
                FillFore(52428,52428,52428); {0=black}
                FillBack(52428,52428,52428); {65535=white} END;

    These lines control the color that the fill is set to. If you want to use the class attributes you could eliminate the IF/Else and just use SetFillColorByClass;


      SetClLSN(CMClass,2);                        {Line style}
      SetClPenFore(CMClass,0,0,0);                {Pen fore color}
      SetClPenBack(CMClass,0,0,0);                {Pen back color}
      SetClFPat(CMClass,2);                        {Fill pattern}
      SetClFillFore(CMClass,cRed,cGrn,cBlu);    {Fill fore color}
      SetClFillBack(CMClass,cRed,cGrn,cBlu);    {Fill back color}
      SetClUseGraphic(CMClass,TRUE);            {Use gfx attri at creation}
      SetClLW(CMClass,180mm);                    {Line weight}

    This section sets the attributes of the class based on the RGB values you specified earlier in the script. But it does not tell the object you are drawing to use the class attributes. But the next line switches the active class so that the class you set the attributes for is not active. So this code is not really doing much for you.


    I don't know exactly what you are trying to accomplish, but if you want to use the class attributes, you need  to change the first block to make all the attributes ByClass instead of the settings that are shown. Then when you change the class the object will use the class settings. And if you do this you can simplify the script to remove all of the RGB setting code as that will all be done in the class setup.


    If you want to manually set the attributes as you are doing that is fine, but you can't manually set the attributes and then also expect them to use the class settings. It is one or the other. 


    If you are using attributes by class you probably don't want to change the class attributes in the script that is drawing the objects as everything else in the file using those class attributes will also change. You will probably need to have a wood class and an aluminum class and set the object in the correct one rather than setting the attributes manually.



  14. The FillBack, FillFore, etc. are setting the defaults for the document. Any new object drawn will use those attributes.


    It sounds like you actually want to set all of the attributes to be ByClass so that when you change the class of the object the attributes will change also.


    Check out the SetLSByClass (and all of the other ByClass functions) to set the attributes by class. If you use the offline function reference, you have the option to "View By Class" at the upper left. Then check out the section title Object Attributes to see all of the functions that can be used to set object attributes.


    The off-line function reference is in the VW application folder  VWHelp:Script Reference:ScriptFunctionReference.html

  15. I sounds like you want to make sure you have the Allow Numeric Keypad Entry for Instant Data Bar Activation option in the second set of options.


    I you don't have this selected, then by default the numeric keypad is used to switch between the standard views.  2/4/6/8/5  Front/Left/Right/Back/Top.  1/3/7/9 Iso views. 0 Top/Plan.

  16. 4 hours ago, line-weight said:

    Thanks again for taking the time to do this.


    I've looked at the file. Changing the date using your script doesn't change the object visibilities in that viewport, I'm not sure why*


    I think I understand the logic though: the script looks at the build and demo date for each object and then sets the other record to 'true' or 'false' according to the requested date.


    Then the viewport DV uses that value to decide whether or not to display the object.


    This means it wouldn't work if I wanted several viewports, each showing the state of existence at a different date. But I think you are suggesting that this could be dealt with by having a 'true/false' field for each desired year. So the record could have a bunch of true/false fields called "exists in 1955", "exists in 1970", "exists in 1991" etc. And the script would populate some/all/none of those fields as necessary.


    * When I look at the viewport DV settings in your file, for the 'Data Visualisation-4' viewport, I notice:

    - 'Enable Data Visualisation for This Viewport' is not ticked (I think it should be?)

    - It's set to 'Record Field': Build (I think it should be set to Record Field: Year)

    - Under Record Field: Year, in the values list, 'False' is set to show with pen/line thickness (I think it should be set to fill=none and pen=none)


    Having changed the above, it still didn't work.


    The script does seem to tick/untick the true/false box correctly (when I look at the objects on the design layer), but somehow the DV is not doing what it should.


    I have it working here in both 2020 and 2018. Visualization in 2020 has been greatly enhanced, so if you really need to do this, you should at least consider upgrading.


    There is a very limited set of dates, so only a few dates will show a difference. I know everything will be visible in 1955, nothing will be visible before 1900 or after 2000, and at least some items will be invisible in 1991.


    You are correct. If you need multiple dates we can either modify the script to give you boolean fields for those dates or give you multiple scripts that store the data into different fields that can be used on different viewports.


    You are correct that the Enable should be on and the Record Field should be Year.  For False the pen and fill should be None. I don't know why it is not working for you. Unless you are using OpenGL where it did not seen to hide objects properly.



    Year 1991


    Year 1955



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.