Jump to content
Developer Wiki and Function Reference Links ×

Script needed for speeding up tedious workflow!


Recommended Posts

Hi, I'm looking for a way of automating a simple but very time consuming workflow.  I'm new to scripting and marionettes in Vectorworks so I'm struggling to be honest!

I've attached a test file which includes a whole series of internal room outlines, which consist of 2D Polygons buried within a unique symbol for each room.

Basically we want to create a 3D massing model using this 2D file, whilst retaining the attached records which we use in a report.  Therefore I would like to keep them as symbols, and just convert them from 2D polygons to 3D .

This means we have to go through the following process....

1) Edit symbol

2) Apply class attributes to polygon fill (fill style set to 'none' currently)

3) extrude polygon by 3000mm

4) exit symbol

5) Repeat for every symbol in the drawing 

 

Can anyone suggest how this procedure could be automated?  I'm having trouble even with steps 2 & 3, but I'm sure they're possible.  Whether or not it's possible to create a script that searches for all symbols in a drawing and edits them one at a time, as above, I really don't know!

 

WorkflowTest_28Feb17.zip

Link to comment
  • Vectorworks, Inc Employee

Hello - 

 

This was an interesting question for me because I have not done much scripting with symbols, so I just made it for you. I am interested to know how you would use this; it seems like you would want more control, such as instead of creating extrudes, creating spaces, or perhaps extruding different heights based off of other data. There is a drop down menu in the wrapper that allows you to select different types of 2D objects to extrude. One of the symbols has a polyline, so I would run it once for polygons, and once for polylines.

WorkflowTest_28Feb17-SB3.vwx

 

  • Like 3
Link to comment

Wow, thank you Sarah. That's really useful. Having more control is never a bad thing! so I really like the drop down menu. Being able to select various object types is great, being able to isolate and extrude particular classes using the tool would also be useful. As you suggest, having control over the extrude height would be very useful too. Although we generally set the room heights as 3m for the massing model, we also extrude the gross internal area by -300mm to create a floorplate. 

 

Normally these drawings don't arrive to us with room outlines as symbols with room names attached in a record field (as per the example above). Usually they're just flat 2D shapes with room numbers in a separate class, not attached to the polygon in any way.  Do you, by any chance, know of a way of scripting a workflow that selects the room number text within the boundary of a extruded shape and applies it to the object name field?  This would also be extremely useful.

 

Alan, attaching occupation and space type information to record formats with a live link to room data in an excel spreadsheet is also something I'm keen to learn get to grips with.

Link to comment

Hi Alan.  Example drawing attached

End game is a 3D massing model that is exported as an FBX file into gaming engine software, Unity. The FBX file needs all polygons and class "ROOM OUTLINES" extruded by 3000mm, and Class "BUILDING OUTLINE INTERNAL" extruded by -300mm.  All extruded must have a fill also to be visible.  Text in class "ROOM NUMBER" currently needs to the entered manually into the object info name field after the polygon is extruded, with the filename prefixed (ie: "WorkflowTest_1stMarch_001) to create a unique Hostkey.  

 

The names of the CAD model classes are never the same for any two jobs, so the ability to select classes before running the script is extremely useful.

 

All of the room data (area, space types, occupants, etc) is stored in a spreadsheet (also provided by client). This is also linked to the Unity model, and is used to drive the colours of the room blocks using RGB values stored in the spreadsheet.  The unique Hostkey is the link between the data and the VWX model.

 

The ability to link the spreadsheet to the VWX model would mean we could attach record formats to objects and any updates made in either part will update the other automatically.

 

Hope this makes some sense?!

WorkflowTest_5March.vwx

Link to comment

@RefurbRich01does the original information come as an excell document? When I used marionette to get data from each symbol it calls up default value in text. WIll look again to get data from each room. The room shape also, do you have to draw it? I am thinking to look at the raw data you get and see where's we can go with this to achieve your goal.

i played with uniy3D when it first came out as beta test. Been toying with it again to possibly use it for client 3D VR walk throughs.

will look at file tonight, you can certainly class name all the items you create in a network.

Edited by Alan Woodwell
Link to comment

Hi Alan

Yes all the data displayed in Unity is in an excel document provided by the client.

The room shapes are all (usually) pre-drawn in the CAD files provided, so we only need to extrude them.  Converting them into spaces seems like the way to go, but only if the space number can be made to match the room number within it (with file name prefixed).

Link to comment
  • 2 weeks later...

Hi 

 

While nobody has time to build this script for you, maybe I can help you to build it yourself.

 

1. You Need the Sheet as a Text Tab oder a character separated Text File. You can save that out of excel.

2. Or you copy paste the list into a Vectorworks Worksheet

 

3. First you have to grab this List. The Script-Part for doing that is available.

Example:

https://forum.vectorworks.net/index.php?/topic/42135-node-example-for-filling-an-area-with-symbols/

And a new and more flexible node to import csv files here:

https://forum.vectorworks.net/index.php?/topic/47801-the-rest-of-domc-nodes/

 

With this nodes, you will be able to pull your (excel)- List into Vectorworks

 

4. Next you need a key value. A value, that is part of your excel ist and a value, that is attached to your object in Vectorworks. You have several method to do this:

a. Attach a Record to your room-polygon and manually attach the room number (You could automate room numbering, but this will not match to your list I think)

b. Or you convert automatically your polygons into space objects. Which has automatically a set of recordfields attached.

 

5. You have loop through your list and through your object (spaces or polys) and let the script search for a matching key. And if the key in list and from the object is identically, you change (duplicate your poly on a new layer and extrude by the value) or directly change the zheight of your space.

Also this script engine is already existing here:

https://forum.vectorworks.net/index.php?/topic/42135-node-example-for-filling-an-area-with-symbols/

 

6. Also you would be able to use your originally symbols for doing this. I think you have to locate the symbol position. Then go inside symbol and take the geometry object inside of it and move it to the symbol position outside on a new layer as Example. Or you directly change your symbol if it is unique. Maybe this Script can help you to find a way get something from inside a pio (path Space etc.) and place it at the same coordinates like the object was: 

 

This would be a complicate part, because there are no standard nodes which can pull a geometry out of a symbol and place it an the new matching place. But the code inside the node "Obj on Space" shows how it can written in python.

 

https://forum.vectorworks.net/index.php?/topic/47218-batch-export-of-pdf-thumbnails/

 

Or the Node "Get PlugIn Position" can help you to move the poly out of symbol. The node is posted here:

https://forum.vectorworks.net/index.php?/topic/47801-the-rest-of-domc-nodes/

 

 

Or maybe a much more simple idea:

1. Duplicate your symbols

2. Use the "Convert to Group" node to get the poly inside the symbol

3. After that, you have to attach the symbol name on that poly (or another key see above ... because the poly will forget in which symbol it was) to match it with your excel list.

Convert to Group Node can be found here:

https://forum.vectorworks.net/index.php?/topic/47801-the-rest-of-domc-nodes/

 

 

I hope this help to get a start-assist for creating your script.

 

 

 

 

 

Link to comment

OK

I read the full text :-)

 

1. Find A way to attach your existing text-fields to a record or room record. Because you will need much time and will make errors by manually enter the room numbers. Attached a Script which will make this.

- First extrude all polys and Ungroup. Do not use rectangles. It will just work with polygons and polylines. Also do not move the extrudes the script access to the content of the extrude and those coordinates.

- Attach Record Format

- Run script

 

This Script also works for other text-field and infos. With this Script you could also get the class and write it into a record field. Build this more to have a Script which nurse all needed Informations and attach them to your extrude. So could ground all further scripts on this record data. Just an Idea.

 

3. Script which access the list (see above)

 

4. Next Step. Whith 3D Info, you can get the zValue of your extrude and Set 3D Info you can reset the extrude zValue. 

 

Maybe a first step for automate the complete workflow.

 

 

 

ExtrudeLinkToList.vwx

Attach_Record_from_Text_Field.mp4

Link to comment

Thanks DomC!

As you say, I need to dive in and try out some scripting by the looks. Coming into it cold, It's different to understand how to arrange things and understand what each command / plug in allows you to do. After some initial efforts, I've not had much success to be honest, but I'm sure it will click at some point through trial and error! You have given me some useful ideas here, which I'm sure will help. 

Link to comment

Why is it if I have this 2D symbol with records attached i can manually enter the 2Dsymbol, extrude the 2dpoly by 3m and exit and the symbol becomes a 3D and still holds the records. If I try to do with Marionette nodes I end up with an extrude and no records left. Maybe someone can point me in the right direction.

Thanks

1_Block_test.vwx

Capture.JPG

Edited by Alan Woodwell
Link to comment
Quote

 2Dsymbol, extrude the 2dpoly by 3m and exit and the symbol becomes a 3D and still holds the records

 

 

1. Linking Symbol with Record

- Enter Symbol, DSelect all, Link to Record

- All New Placed Symbols in the Drawing have now a Record Link.

- All existing Objects in the Drawing keep their Recors Link or their non-record Link. 

 

2. Why record Links still there after Extrusion

- If you link the Symbol Container (like above) the symbol is linked to the record, not the poly

- So the symbol always keep the record. Whatever is inside the symbol

 

b.t.w. think we are rotating in a circle.

I think this is no sorcery but it think we need more specifications. Because all the technique for this is already there. 

 

- Contains the List a unique Room Number (Every layer different or is the Layer Name part of the unique Room ID)?(OK, the Room Number is a Text field in the Drawing. But is this text is already there or is this text in a list at the beginning.

 

- Is every project on a single story/layer?

- Contains the List an Extrusion Value for the Room?

 

The other known specifications:

- We need a Name in the Object Info "Name"-Field

- This Name depending on text in a specific class (so maybe an input field for class name)

(Running a Marionette by activating things is not working -> So the better way for this workflow is a python Vectorscript)

- This "Name" value does something after the export to unity model?

 

Next Steps:

 

1. I think it is the first step to link objects to room number  and room extrusion (bevor we think about symbol extrusion etc.)))

Just a small test with the polys

 

2. Next find out, how to extrude an object by the extrusion value and how to name the object in the info palette (which seems to be necessary)

 

3. Find a Way to update and adapt in an easy way, to a new project.

 

 

 

 

Link to comment

Question the area from the records is coming out a a string in m2. I would like to read it as m but the sqm seems to be causing the issue. I have 2 nodes of marissa Str to dim and int but the sqm seems to still be causing the problem. Is there a node I am missing?

thanks

Link to comment

Resolved. Amazing how the subconscious works, walking home from gym the brain suddenly says use the polygon in the symbol to get the area, go for the source.

So it worked, The aim was to use the area to generate the height of each space, Just to investigate using the records to generate different aspects of the space.

Capture.JPG

Capture-01.JPG

Edited by Alan Woodwell
Link to comment

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...