Jump to content
Developer Wiki and Function Reference Links ×

Intro-Guidance for a utility script


Recommended Posts

Hi, all!
I'm fairly new to VW, transitioning from MANY years constructing my own GH3D definitions and an intense 1 year gig on Archicad.
I'm starting to fumble in Marionette and would like to start with a "small" thing, a script to rename (as new "Name" property, that one located at the very-unseeable-bottom of the info palette) a set of hand-or fliter-picked walls, decks, a.s.o.
I'd very much appreciate a little hints-directioning on how to "think" the network. Which subgroups I should use, how to plan the selection and renaming (I'd like to automatize it in a way of "WallLoadBearingTypeA_Level0_001, to WallLoadBearingTypeA_Level0_067...").


BTW, not really looking for/asking for anyone making a network for me, I'd like to build it up by myself! ;)


Thank you all in advance!

Link to comment
  • Vectorworks, Inc Employee

Hi arquitextonica,

 

Welcome to Vectorworks and Marionette.

 

The key in doing successful customization is, as you correctly imply, knowing the right data structures and workflows to get done what you want. This may sound obvious, but is really anything but. For newcomers especially, there can be pitfalls.  As an example, the Object Name field where you want to write the data has its own namespace, and all entries are required to be unique. You may (even probably) won't find this a useful constraint.

 

So one way to think the process is, inputs and outputs.

Inputs: where is the data coming from? The class of the object, an object name, an object property or location, a user dialog, even (gulp) a web page? (You can conceivably do all these); and

Outputs: where is the data going? An existing object property, an IFC property, a new record field you want to attach, a class?

 

I think the mandated-uniqueness of the Object Name removes it from contention. But that's just me.

 

To generate the list of objects whose data you want to alter, use the Objects by Criteria node. Very simple.

 

To read and write classes, and record and IFC data fields, use the nodes in the "Records & IFC" folder in the Marionette library. 

 

You've asked for not too much hand-holding, and I respect that. But feel free to ask if you get frustrated. This is a straightforward task (and well chosen for a learning project because it's about traversing objects in the drawing.) 

 

regards, Robert

Link to comment

Thanks a lot Mr. Anderson,

your explanation was already quite enlightening.
I'm not frustrated at all (yet) with VW, indeed after a week of fiddling I'm already at the point where I expected to be after a month of more...
With Marionette I'm getting contradictory feelings:
I'm very used to Grasshopper structures and having been too lazy had no time due to my ongoing PhD Thesis to learn coding, I built 99.9% of my definitions with pre-built/closed components.
With Marionette I have the feeling coding will be required to "complete/fine tune" the capabilities of the nodes, am I right?


I got, from now just a couple "conceptual questions".
Is it possible to run a network over a bunch of pre-(hand or filter)-selected objects?
Once selected, if I want to generate a quick list of numbers, do I have to "code it" in the node?

Thanks in advance again!!

Link to comment
  • Vectorworks, Inc Employee

Hi arquitextonica,

 

As to your question, "I have the feeling coding will be required to "complete/fine tune" the capabilities of the nodes, am I right?", maybe or maybe not. It depends on what you want to do.

 

I think the secret of using Marionette effectively is knowing how to leverage your knowledge of the Vectorworks API. I kjnow you're new, but this will come with time.

 

You speak of a filtered list of objects. The most efficient way to do this is (as I suggested earlier) using Criteria and the Objects by Criteria node.This is extremely flexible and powerful. Look here for more about Vectorworks search criteria.

 

Foe example, suppose you wanted a list of all plug-in objects that happened to be in class "FOO". You could write the criteria to do this from scratch, but there's an easier way, and that is to have Vectorworks do it for you. You can do this using the Custom Selection... command to create a Python script that you can then copy and paste the criteria string from the Script Editor dialog to be the input in your Objects by Criteria node (select the node and paste into the field in the OI palette). See the screenshots below. You can use this technique to build filtering of virtually any complexity. Without breaking a sweat.

 

Screen Shot 2019-08-11 at 4.37.07 PM.png

 

Screen Shot 2019-08-11 at 4.38.21 PM.png

 

If for example you wanted to operate only on selected objects, well, there's a criteria for that: SEL = TRUE will let you operate simply on selected stuff:

 

Screen Shot 2019-08-11 at 5.28.00 PM.png

 

To respond to your second question, I'm not sure what you mean by "generate a quick list of numbers". Can you elaborate on what you are trying to do here? Are you wanting a count? What "numbers" are we talking about?

 

 

Link to comment

Thank you very much again Mr. Anderson,

 

I understood the filtering, but the "SEL=TRUE" criteria is what I would actually need.
The process should be as follows:

Build a new "set" of walls, decks, etc. during the design process. By myself or by any other colleague from the office.
Tidy the file:

Select the newly created elements and "Name" them according to our office standards.
Here the numbering should come into play, ideally with a "user dialog" or a semi-automatized script that would get f.e. the level, type of element, style of element, and add a number following a sequence (magic would be to get the last number used for that combination in that level and continue the sequence). This last querying and numbering should be made through Python, right? Should I bulid a database to store this numbering in order to be able to query them?

I am prety sure this naming process will have to be done several dozens of times during the design of a project. As I said, making comparissons is not nice but Archicad has an automatic (re)naming tool for all the elements, which I found REALLY useful...
 

Link to comment
  • Marionette Maven

@arquitextonica

Right now, according to your description, all of these things should be doable with existing nodes that ship with Vectorworks, including the querying and numbering.

Look through the Data Flow nodes, they can help you with filtering and sorting.

You'll also probably want to look at the Object Info nodes.

In some cases, you may need to outsource for some information from the developer wiki (for instance when trying to figure out what number an object type corresponds to), this page may help: http://developer.vectorworks.net/index.php/VS:Function_Reference_Appendix

  • Like 1
Link to comment

Thanks a lot for the direction pointing @Marissa Farrell

I think I advanced something, but I guess my many years of grasshoppering are weighing on me.
If you allow me, I got to precise questions about the several mistakes/failures/doesn´t work as I expected...
- Get list length returns 4
   makes "repeat" work ok

   but that makes sequence stop at 4, not have 4 items...
- The solution to sequence is trivial, might be another concept or just "n-1"ing it...
- Turn both lists to string, but somehow either they are not "list of strings" or concat can´t/is not supposed to join a pair of strings.
 

At this point I would appreciate a little hand-holding 😄



 

190812_WallRenamer.jpg

Link to comment
  • Marionette Maven

An alternative to the Sequence node would be Series where you can define Count, or as you stated, you can subtract one while still using the Sequence node.

For Concat, it's taking ALL of the values and concatenating them (as I'm sure you noticed), so we'll have to do a little more handling.

I'll get a file together with an option, probably won't be the best option, but it will work.

  • Like 1
Link to comment

I´ll study your second file in depth tomorrow Mrs. @Marissa Farrell thanks a lot!
I´m just anticipating a question. How would I deal with executing a Marionette over a bunch of selected objects?
I tried making a wrapper out of the network and saving it as a command in hope this would allow me to select and then execute, but it hasn´t been the case.
Any hints in that direction?
Thanks again! After this week and a half of hard VW inmersion got wonderful feelings from the community support behind it!

Link to comment

Thanks again Mrs @Marissa Farrell it worked like a charm.
I´m currently unable to get Dummy End or Priunt Debug nodes to work, so I can´t decypher, and I´m really eager to learn what did you set up and why between the output of the test repeat and the sequence of numbers, I guess you got a zippd "line of text" and you decomposed and reordered it.  Right?

IF I knew python (big if) would it be possible to code a node that took two lists and concatenated the strings in each place?

I´m attaching also a file with the "not working" debugging components.

190813_Listworkout.jpg

NO DEBUG.vwx

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...