Jump to content

Miguel Barrera

Member
  • Content Count

    652
  • Joined

  • Last visited

Everything posted by Miguel Barrera

  1. 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.
  2. 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.
  3. In my workflow I always create objects in the "None" class ,then after the object is created I change the class to the correct one in the OIP at which time I will get the color feedback so I know it is in the right class.
  4. 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.
  5. Meaning just like you create hybrid symbols. You include both a 2D and a 3D object(s)
  6. 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.
  7. 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.
  8. 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.
  9. 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.
  10. Make sure that the profile object is a group as in: BeginGroup; profileObjects EndGroup; 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); VAR dz: REAL; BEGIN dz:= elev - org3Dz; IF dz <> 0 THEN BEGIN Move3DObj(objHdl,0,0,dz); ResetObject(objHdl); END; END; 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.
  11. 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.
  12. yes you can change the popup item list with vectorscript. see below for more info: Custom Shape Pane Popup However, the plugin has to be event enabled to update the popup after each interaction in the object info.
  13. I am glad that it helped you
  14. 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; InitODBC(dataName,tablName,hdrName); 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,'%'''); WriteLn(shtData.sqlQry); foundDB:= FALSE; IF DBDocGetDB(dbConnList) THEN BEGIN IF DBSQLExecute(dataName,shtData.sqlQry,colTot,resSetInst) THEN BEGIN ProcessRecs; foundDB:= TRUE; END ELSE IF DBSQLExecuteError(errMsg,errState,errCode,intDesc) THEN WriteLn(errMsg,', Code = ',errCode); END ELSE IF DBSQLExecuteDSN(dataName,kDB_USERNAME,kDB_PASSWORD,shtData.sqlQry,colTot,resSetInst) THEN BEGIN ProcessRecs; foundDB:= TRUE; END ELSE IF DBSQLExecuteError(errMsg,errState,errCode,intDesc) THEN WriteLn(errMsg,', Code = ',errCode);
  15. You can link an excel file to vectorworks with ODBC. I use the connection to fill-in fields with vectorscript in a form based on a user selection. However, the primary function of the ODBC connection is to link the database (excel file in this case) to Vectorwork objects with a common key field and it seems that is exactly what you are trying to do.
  16. Are there any examples of how to add python routines into vectorscript?
  17. You can get the volume and then divide it by the height of the slab to give you the surface area. You just need to check for the unit of measure returned by the functions
  18. Another way to structure the pio is to have the pio origin at the object it is connected to and have the control point as the moving part of the pio.
  19. Just the fact that you changed the object, it should call the regeneration code. To test whether the length has changed, you could store the last value in a hidden parameter and then compare to the new length.
  20. In your code above, the reset to each object in the loop will happen only after the DoMenuTextByName call or the last line of code.
  21. The problem with resetting the plugin is that the code has to complete before it actually gets reset. It does not happen immediately when it is called. What I do is set a hidden Boolean parameter to true on the first reset event. When the pio goes through the second reset event, it will encountered the true value and execute the code in question and then I will set the parameter back to false.
  22. developer mode is in the Vectorworks Preferences->Session->Run scripts in developer mode
  23. My own experience is to change values in the reset event. the typical work flow is : assign parameter values (either default or user entered) to variables with the P value or GetRField. find which parameter has changed and update any other variables as needed. redraw the plugin with the new values. assign the variables to the corresponding parameters at the end of the reset procedure with SeRField. If I see that some value is not changing when it is supposed to I will turn on the debugger and trace the value in question to find out why it is not changing. I work exclusively in vscript because the debugger is readily available. I have tried to setup the debugger in python but with no success and is the main reason I have not jumped into python. If you can get the debugger to work for you, it will help you a lot in finding any bugs in your code.
  24. Sorry, I got this confused with added buttons where you do assign your own ids. But knowing that parameter ids start at 1 and are added sequentially you can still loop these values. For the second grouping, you could add 100 or any other number to the parameter ids.
  25. I would think that they get assigned on the first event because they are available for setting up popup menus, parameter visibility, and any buttons clicked. If I need to change any value I will do it during the reset value with SetRField.

 

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.

×
×
  • Create New...