Miguel Barrera
-
Posts
663 -
Joined
-
Last visited
Content Type
Profiles
Forums
Events
Articles
Marionette
Store
Posts posted by Miguel Barrera
-
-
Are there any examples of how to add python routines into vectorscript?
-
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
-
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.
-
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.
-
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.
-
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.
- 1
-
developer mode is in the Vectorworks Preferences->Session->Run scripts in developer mode
-
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.
-
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.
-
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.
-
you can if the plug-in is event enabled and you assigned the ids manually during the setup event.
-
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. 😉
-
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.
-
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.
-
-
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.
-
try:
FUNCTION GetPluginChoiceIndex( inPluginName :STRING; inParameterName :STRING; inChoiceName :STRING; VAR outIndex :INTEGER) : BOOLEAN;
-
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?
-
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.
-
yes, you can also link several worksheets to a main worksheet by reference.
-
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
-
8 hours ago, Don Seidel said:
Vectorscript? Why? It's (year) 2017...VW is supposed to "connect" to an external DB without fuss. Particularly on the Mac OS and particularly with FM Pro, it should be a snap. One should NOT have to be a VS or DB Geek to set it up and make it work, and yet the instructions are not clear & simple. I've looked but never seen a simple VW file example w/ associated DB.
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.
-
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
-
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.
Updating Record from Excel Spreadsheet
in Marionette
Posted
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.