Jump to content
Developer Wiki and Function Reference Links ×

Using Marionette for automated average grade calculations?


Recommended Posts

Hello all,

I haven't gotten to dig into Marionette as much as I'd like, but am hoping I can get some feedback as to whether the following is possible...

We often have to calculate average existing grade for building departments in the following manner:

1) trace the footprint of the proposed building

2) measure the height of the existing grade at the midpoint of each line (wall)

3) measure the length of that footprint segment

With the Z-coordinates of the midpoints and each segment's length, we then calculate the length-weighted average height for the footprint as a whole. Presently we're manually placing Stake Objects along line midpoints at the footprint segments (sent to the surface of the 'existing' DTM with Send To Surface); point ID numbers and segment lengths are entered manually, and the whole thing is then calculated in a worksheet.

Ideally Marionette would allow us to just trace the footprint with a polygon or polyline, and then place the 3D points automatically (with labels displaying an index number and the elevation) and then provide the Z-value and segment length to the worksheet. Within the realm of do-ability?

Thanks for any and all feedback!

Cheers,

Markus

p.s. attaching a screenshot of a typical AEG calculation...

Link to comment
  • Marionette Maven

In short, ABSOLUTELY.

I'm attaching a file that starts the process, I don't have a site model to work with at the moment (if you have a small file you could share, I could work with that)

In this case, the building is composed of walls. We could explore using other objects as well - spaces, etc. (It all depends on how your footprint is created/best represented) There are functions available in Vectorscript that I think would work to get your Z value at the points on the site model, they aren't currently included in the Marionette library, but I can create them.

And obviously my data attached to the text & worksheet isn't accurate to what your template is, but I'm demonstrating that we can put it there if we can extract it.

Does this look like something that would help solve your problem?

Edited by MarissaF
Link to comment

Thanks so much for the file, Marissa. Here are the DTM and AEG elements from a file I'm currently working on. The footprint in many jurisdictions is formed by the outermost walls, including overhead cantilevers, so we typically just draw a polygon (I suppose a space would do just fine as well). The file also includes the worksheet we've been using to date...

Link to comment
  • Marionette Maven

I'm attaching my addition of a script to your file in order to get the information you're querying.

I didn't incorporate the worksheet nodes into this file, but you can bring them in from my previous one and they should work with this one as well, as long as you wire them correctly.

I had to name both your site model and building footprint in this circumstance, although there are other ways to grab the handle to the objects... I just find this more consistent.

I created the node "Site Z Height" to get the Z value at each midpoint, it appears to have the exact results of your stake objects, so I'm feeling confident. (The slight difference is the numbering of the midpoints, if this matters, it can definitely be adjusted.)

If you need more help after playing with this a bit, feel free to reach out. I hope this was helpful!

Marissa

Edited by MarissaF
Link to comment

Thanks so much Marissa! I was able to combine the two scripts and get the expected results. I've changed the expected name for the poly to "AEG footprint" and the output name for the worksheet to "AEG data".

A couple of remaining pie-in-the-sky items would be:

  • automatically add the data to the "Diagram - AEG per DR 4-2012 (Marionette)" worksheet starting at row 7 (though a simple copy & paste isn't that big a deal)
  • place something like an elevation marker (or custom symbol) instead of a locus
  • change the text to vertically centered justification & rotate it, say, 45°

If I understand correctly, you wrote the "Site Z Height" node from scratch, right? How about the worksheet nodes? I don't see those in the list of available nodes using the Marionette Tool...

I'll attach the updated file for your reference – thanks again!

Best,

Markus

Link to comment
  • Marionette Maven

So I touched on all of those wishes you had with the attached revision.

The worksheet specified should update accordingly (node about "Create Worksheet", if the worksheet already exists, it will provide the handle to the worksheet without changing anything about the existing worksheet, I'll clear that up in the description later.)

I changed the locus node to a Symbol node, which allows you to choose which symbol is inserted by name. I've boxed that in the script in yellow.

Modification of the text was implemented using the Set Text Orientation, I also included the "Set Text Properties" node to allow you to define justification/spacing/etc. The description gets cut off as to what the parameters are in the dialog box currently, but if you open the script inside the node, you can read the values associated with justification.

Let me know how this works for you!

Link to comment

Thanks Marissa – that's fantastic! The only thing I noticed is that the last label is placed twice, and with my limited skills, I've not been able to remedy this. Also, I've noticed that if the footprint polygon is not correctly named, the script freezes the whole app. Is there a way to use an if/then statement to prevent this and perhaps display a message along the lines of Footprint polygon needs to be named "AEG footprint" if the name is not present?

Finally, is there a way to save to and run this from the resource browser or a script palette? I've seen that it's possible to save the Marionette script as a Python script, but then when I try to paste the Python code into a new script I get the message that the Script Editor cannot save a script with more than 32001 characters, and it looks like File>Import Script only executes a script immediately

Thanks again, I so appreciate all of your help on this!

Cheers,

Markus

Link to comment
  • 2 weeks later...
  • Marionette Maven

Sorry Markus!

This accidentally fell off of my radar!

I looked at your file and failed to see where you're using a "Objs by Crit" node. Are you possibly referring to the Name node?

Either way, we can definitely add an if statement to prevent it from freezing Vectorworks.

As for your question about saving the Python script to the script palette, since you're receiving the character limit, I would say no. And you're correct that it will execute immediately if you use Run Script.

There may be a way to save it as a menu command, but I'm not familiar with the process as of yet. Maybe another user could point you in the right direction.

Link to comment

Hi Marissa, sorry, looks like I'd uploaded the wrong file. I switched to "Objs by Crit" to make the script slightly more user-friendly, but it does ook like it'll freeze VW with either node if it doesn't find an object that matches the criteria, so it'd be great to be able to solve this with an if statement (or some other solution?)!

I imagine that in order to save the script as a menu command I'd still have to be able to compile it – perhaps there's another compiler out there that can handle the excess length? Is anyone else familiar with something that would do the trick?

Thanks so much!

Cheers,

Markus

Link to comment
Guest unlimited

Its useful to know that this limitation exists - thanks.

I notice that within the Script Editor, if it is set to Python script the advice is to use the 'import statement', whereas if it is set to Vectorscript the message advises using the ($INCLUDE) mechanism.

It would be very useful to understand how this works.

Anyone?

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