Sadamo Posted July 18, 2017 Share Posted July 18, 2017 Hi All, I am looking to write a script that can help me add text and adjust color / opacity attributes of a group. I am looking for the script to preform the following: - Select all record objects - Change object fill to predetermined color. - Change object fill opacity to 50%. - Add center justified text box at center of object displaying information in a record. - Convert objects to group. What would be the best way on creating a script for this. I am compleatly new to vectorscrip. I am not sure if Python or verctorscrip makes more sence. I have been working in the vector editor and keep getting identifier errors. Any insite would help me move forward. Thanks! Quote Link to comment
Vectorworks, Inc Employee Robert Anderson Posted July 18, 2017 Vectorworks, Inc Employee Share Posted July 18, 2017 Vectorscript and Python (and, for that matter, Marionette) are basically identical APIs. So factor one in choosing your API is, which language syntax are you more comfortable with, Pascal (which Vectorscript uses) or Python? The process you describe (operating on selected objects) is an analog of a manual process, i.e., it is the way you'd do it 'by hand' in the Vectorworks interface. What you learn as a programmer is that there are other (possibly more powerful) workflows that become apparent and give you a lot of flexibility. Just as an example, if I were going to perform a repetitive operation on a number of objects meeting a particular criteria (e.g. having a particular record,) I'd use a function called ForEachObject(). This allows me to establish a criteria ('find me all objects with the XXX record') and pass them to a process that modifies them (e.g. the FadeAndLabel() process). This is done using a data concept of "handles", which has no good analog in manual use of Vectorworks but is central to efficient use of Vectorworks using any API. Not sure about your last procedural item: "Convert objects to group". Do you mean group all the processed objects, or actually convert e.g. a plug-in object to a group? (The latter is a more profound operation, and might be considered 'destructive'.) Not sure what you mean by 'identifier errors'. Maybe you post a screenshot of an error alert on the forum. Good luck! R Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.