Jump to content

Miguel Barrera

Member
  • Posts

    663
  • Joined

  • Last visited

Everything posted by Miguel Barrera

  1. 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.
  2. Are there any examples of how to add python routines into vectorscript?
  3. 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
  4. 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.
  5. 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.
  6. 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.
  7. 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.
  8. developer mode is in the Vectorworks Preferences->Session->Run scripts in developer mode
  9. 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.
  10. 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.
  11. 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.
  12. you can if the plug-in is event enabled and you assigned the ids manually during the setup event.
  13. You can also find the function reference at http://developer.vectorworks.net/index.php/VS:Function_Reference for the correct spelling if you have not memorized all of them. 😉
  14. it should actually be SetFillBack(h,0,0,0) for black color. You also need to be careful with the scope of the IF statement. The IF statement should be formatted as: IF (oldLW = 2) OR (oldLW = 5) OR (oldLW = 7) OR (oldLW = 10) OR (oldLW = 14) OR (oldLW = 20) THEN BEGIN SetFPat(h,1); SetFillBack(h,0,0,0); SetOpacity(h,50); END; The BEGIN and END calls are required to mark the start and end of the IF statement. Otherwise if you omit it as shown in your previous script: IF (oldLW = 2) OR (oldLW = 5) OR (oldLW = 7) OR (oldLW = 10) OR (oldLW = 14) OR (oldLW = 20) THEN SetLW(h, newWeight); SetPenFore(h, 0,0,0); SetFPat(H1,0) [zero]; SetFillBack(h,0,0,0); Only the SetLW procedure will be executed under the IF statement. All the other procedures following will be executed for all objects.
  15. You will need to add the following 2 procedures after SetPenFore(h, 65535,0,0): SetFPat(h,1); SetFillBack(h, 65535, 0, 0); {Red fill color} If you need to find the RGB color value other than red, create a rectangle with the attributes that you want in a blank document. Export the file to Vectorscript and you will find in this text file that the attributes are listed prior to the creation of the rectangle.
  16. if your first worksheets has the total, you can reference that cell into the second worksheet that only contains totals.
  17. And if you are creating a hybrid (2D/3D) object, you can use GetSymLoc3D() to find the z location of the object's origin. If the document's page center is other than (0,0) you will also need GetOriginInDocUnits() which should be added to GetSymLoc to get the correct coordinates.
  18. try: FUNCTION GetPluginChoiceIndex( inPluginName :STRING; inParameterName :STRING; inChoiceName :STRING; VAR outIndex :INTEGER) : BOOLEAN;
  19. My question would be why do you even want to export to excel in the first place? If it is for some kind of mathematical analysis, then why not do it in VW with scripts?
  20. In order to parse the events, you will need to call vsoGetEventInfo( outObjEvent :; outEventData :); the first variable is the event number, and the second is additional info on the event. In the case of a button hit, the second variable will be the button id that you assigned when the button was created so there is no error generated if the button has the same id as an event. As a practice however, I do start buttons in the 1001 range to avoid any conflict with buttons defined in vectorworks.
  21. yes, you can also link several worksheets to a main worksheet by reference.
  22. Sorry I cannot help you with your Mac. The last time I owned a Mac was in the early 2000's. I have developed a VS plugin that searches for information contained in an excel file through a Windows ODBC driver and manager app, which are included in the Windows OS. For the Mac, if there is no ODBC manager included in the OS, you can get one from http://www.odbcmanager.net/ There is also a guide to install and configure a filemaker ODBC connection here (Chapters 3 & 4): https://fmhelp.filemaker.com/docs/16/en/fm16_odbc_jdbc_guide.pdf
  23. Don, you can do a lot more with the database through programming than just a simple one to one relationship as it is in the VW interface (link a row to an object with a common key field). You could for example, import a database or spreadsheet into a VW worksheet by choosing the file from a folder dialog or do searches to get a particular data, etc. I think that those that have not worked with ODBC, do not know that the first step is to connect the database to the ODBC driver, which translates the original format to a SQL database. This is done in the OS and not in VW. In windows you use the ODBC Data Source Administrator (odbcad32.exe) to make an ODBC alias. The alias then can be connected to VW through the "Manage Databases..." menu command. You can't make it simpler than that due to all the different databases around. I have done some research and found that the first step can be done in python with the following code: import pyodbc # Specifying the ODBC driver, server name, database, etc. directly cnxn = pyodbc.connect('DRIVER={SQL Server};SERVER=localhost;DATABASE=testdb;UID=me;PWD=pass') # Using a DSN, but providing a password as well cnxn = pyodbc.connect('DSN=test;PWD=password') # Create a cursor from the connection cursor = cnxn.cursor() so it is feasible to do all the connections within Vectorworks to access the data.
  24. You can also use ODBC to connect to databases either from VW directly or programmatically with vectorscript. You can find a connection example at http://developer.vectorworks.net/index.php/VS:DBDocAddConn and all routines at http://developer.vectorworks.net/index.php/VS:Function_Reference#ODBC
  25. Adding 3D polygons between co-linear 3D points should fix the problem. As illustrated in your images, there are some points that cross the co-linearity of the the 3D points but if you add a 3D polygon or line, the DTM triangulation algorithm will not cross the line.
×
×
  • Create New...