Jump to content

Miguel Barrera

  • Posts

  • Joined

  • Last visited

Posts posted by Miguel Barrera

  1. I think the biggest advantage of using vectorscript is the built in debugger. Although is possible, according to the python pages, to uas a third party python program to debug, the instructions are vague and I have never been able to successfully get the remote debugger working. If Nemetschek would add a native interface with a debugger, python would be the better choice because it can interact with data and systems outside of vectorworks.

  2. I have coded something similar to what you want. Several years ago, I faced the same problem where I had a lot more fields than I could display. Although all my plugins are event enabled I came up with this solution before there was event enabled plugins so I do not think it is required. In the following you will see buttons for each section. When you click on each, it will display more fields under it. In the example below, the button "Pole & Foundation" displays a few fields and the button "Ped Push Button" displays only one. When clicked on each of these, they display all the fields associated with each button.


    The concept is to keep a hidden field with the state of each button. 0 for closed and 1 for open. When setting the field visibilities, I hide the filed if the button is 0 or display the field if the button has a value of 1. In the example below, there are 7 buttons. On the left they are "closed" so the state value is 0000000. When I click on the first, it displays all the fields. When I change the value on the second button from "none" to "2", it displays the fields under that button. The state value is consequently 1100000




  3. But sometimes the result outweighs the pain of writing Python. Although I still prefer vectorscript because I am more familiar and it is easier to debug, python has access to most functions outside of VW and you could script almost anything. I have been able to directly import from and export to excel files which is not easy to do in vscript so learning and coding in python was well worth it

    • Like 1
  4. Quote

    when I want to draw ten objects in the same class. It would be rather tedious to draw them all in "none" and then change them each individually


    why individually? you can change all the selected objects at once.


    let me also say that most objects I create are custom made so the scripts assign their classes automatically and I do not have to do the post-classing for every object created.

  5. Quote

    However I don't think that's everyone's workflow, and it's clearly not intended in the design of VW that the software should/must be used that way.


    Of course it is not everyone's workflow since you already mentioned that you pre-class the objects and that is your preference. However, VW gives you the choice to do it either way. If the intention of the programmer was to corner you to do it only one way, then he would not allow you to change it in the OIP.

  6. In windows there are multiple copies of odbcad32.exe so you need to find which one is visible to VW. I did a search on the windows folder and found 4 copies. The most relevant however, are located in the C:\WINDOWS\SysWOW64 folder, which applies to 64 bit applications, and the other is in the C:\WINDOWS\System32 folder, which applies to 32 bit applications. If it does not appear in the VW dialog, then you need to configure the other odbcad32 administrator.


    In my system, I found that the one in SysWOW64 works with VW.

    • Like 1
  7. I noticed that you placed the pio in Plan View which is a 3D view. That explains to some degree why the extrude fails and the pio disappears. Since the extrude fails for whatever reason, you are left with a rectangle and a circle which are 2D objects and you cannot view these objects in Plan View. It is only when you  switch to Top/Plan that they reappear.


    the solution would be to create a Hybrid object. That is create the rectangle with the circular hole first in Top/Plan view and then duplicate and extrude the copy to create the 3D part.

  8. Parameters are only for plugin OBJECTS, These you create yourself if you want the user to enter a value such as dimensions of rectangle, radius of circle, etc. which will be listed in the Object Info palette.


    Since the sample script is a COMMAND, it does not have any parameters defined.

  9. As JBenghiat said, there is no way to create a pulldown with submenus out of the box but you can simulate something similar. Before the tree control, I had the same problem trying to show symbols located in subfolders. It has been a long time but I think what I did was to mark folders that had submenus. When the user click the marked folder, I would clear the menu and show the contents of the parent folder with the parent as the first item and then the contents offset by a couple of spaces. When the user clicked the parent header folder, I would show the higher level once again.


    Of course you need to keep track somehow the relationship between parent and nested items or folders.

    • Like 1
  10. You could also export the file as a vectorscript text file. This will show how vectorworks creates the nurbs curves as a script. It is very accurate for simple geometry but it tends to skip objects with more complicated geometry.

  11. Make sure that the profile object is a group as in:





    profileHdl:= LNewObj;


    I have not come up with the offset elevation problem because I do keep the insertion point at 0 elevation for all PIOs. However, I do have to place the PIO at the same elevation as the terrain model. Rather than change the layer elevation , I move the entire object to the desired elevation as in:


            PROCEDURE SetElev(objHdl: HANDLE; org3Dz,elev: REAL);
                dz: REAL;
            dz:= elev - org3Dz;
            IF dz <> 0 THEN

    I did have a problem at one time with the change in elevation not showing so I had to add the ResetObject to fix it.


  12. Do you need to see the graphic of the symbol? If not, why not just add the symbol name to a popup parameter.

    I have not used vsoButtonGetResource because it is only available from VW 2018. I created the following dialog in 2014, Select Sign Legend, which would be similar to that. The dialog is activated by clicking on the OIP LEGEND button and the selected sign is store in the Sign Type parameter. Other parameters get their value from the record attached to the symbol.




    The following is a variation of the same idea but the dialog has a tree picker control instead. I created this plugin to scale symbols before the capability was added to symbols.



    • Love 1
  13. First you have to make the ODBC connection in your system with an odbc administrator. I have windows so the following step will be different in a Mac.

    1. Open odbcad32.exe located in C:\WINDOWS\syswow64.

    2. Create a User DSN or System DSN and click Add

    3. Select the driver for the database and click finish. There are a select number of MS drivers including excel files that ship with windows.

    4. The following dialog will vary depending on the driver chosen. For databases, it will have connection options such as user name and password but for excel files, you just need to select the spreadsheet. Enter the Data Source Name, which is the database name that VW will see, and click OK.


    In VW

    1. Click on the menu Tools->Database-> Manage Databases...

    2. In the next dialog, click on Connect

    3. Under Use Data Source Name, the system ODBC that was created above should appear in the drop down list. Select the DSN and click OK.


    The following is a vectorscript snippet that shows how I get the connection. It looks for a connection in VW first and if not available, it will connect directly to the system ODBC. 


    	dataName:= kDB_DATANAME;
    	tablName:= kDB_TABLNAME;
    	shtData.sqlQry:= '';
    	shtData.sqlQry:= Concat(shtData.sqlQry,'SELECT * FROM ',tablName);
    	shtData.sqlQry:= Concat(shtData.sqlQry,' WHERE ');
    	shtData.sqlQry:= Concat(shtData.sqlQry,hdrName.primarySt,' LIKE ''%',shtData.st1Lt,'%''');
    	shtData.sqlQry:= Concat(shtData.sqlQry,' OR ');
    	shtData.sqlQry:= Concat(shtData.sqlQry,hdrName.secondStr,' LIKE ''%',shtData.st1Lt,'%''');
    	foundDB:= FALSE;
    	IF DBDocGetDB(dbConnList) THEN
    		IF DBSQLExecute(dataName,shtData.sqlQry,colTot,resSetInst) THEN
    			foundDB:= TRUE;
    		ELSE IF DBSQLExecuteError(errMsg,errState,errCode,intDesc) THEN
    				WriteLn(errMsg,', Code = ',errCode);
    	ELSE IF DBSQLExecuteDSN(dataName,kDB_USERNAME,kDB_PASSWORD,shtData.sqlQry,colTot,resSetInst) THEN
    		foundDB:= TRUE;
    	ELSE IF DBSQLExecuteError(errMsg,errState,errCode,intDesc) THEN
    			WriteLn(errMsg,', Code = ',errCode);


    • Like 2
  • Create New...