Jump to content
Developer Wiki and Function Reference Links ×

Divide a line by a finite length


Recommended Posts

Hi,

 

I would like to know if it's possible to divide a line into a segments of a finite length. For example, if I have a line of 42'6" and I want to divide it into segments of 4' each with the last line being 2'6". There doesn't seem to be a divide by length node in marionette (which is available on grasshopper). Any ideas on how this can be done?

 

Thank You

Link to comment
  • Vectorworks, Inc Employee

@Pat Stanford it may be worth noting that you cannot convert a line to a polygon without adding a third vertex. This is totally logical to old VWX dinosaurs but may not be for newbies. @Aneesh Carvalho other than that, what Pat says. That method will give you the first point on the polygon only so you need to use some more nodes to get the others. Something like this works:

image.thumb.png.bf3d8cd242f3ac9d71185e20540394a3.png

Name the polygon (bottom of the Object Info Palette) and use that as a criteria in the "Objs by Crit" node to identify the object that you want the Marionette to act on. Note that the polygon has three vertices, so it looks like a line but is, in fact, a polygon.

  • Like 2
Link to comment

@Pat Stanford and @Stephan Moenninghoff Your suggestions were great. Pat's suggestion did however work for me for what I was trying to achieve. However, I'd like to know if it's possible to change the co-ordinates of a symbol in marionette?

I used DomC's "Create Symbol" node but the coordinates are not what I want them to be.

I want to be able to create a symbol and place them evenly on the points of a line you just helped me solve. Your help has been much appreciated.

Thank You

Link to comment
  • Vectorworks, Inc Employee
26 minutes ago, Aneesh Carvalho said:

@Pat Stanford and @Stephan Moenninghoff Your suggestions were great. Pat's suggestion did however work for me for what I was trying to achieve. However, I'd like to know if it's possible to change the co-ordinates of a symbol in marionette?

I used DomC's "Create Symbol" node but the coordinates are not what I want them to be.

I want to be able to create a symbol and place them evenly on the points of a line you just helped me solve. Your help has been much appreciated.

Thank You

The Symbol node takes a point input. Just replace the locus node with the symbol node and reference your symbol.

  • Like 1
Link to comment
  • Vectorworks, Inc Employee
12 minutes ago, Aneesh Carvalho said:

@Stephan Moenninghoff Yes, I did do that. However, I don't want the symbol to be placed on the line at the symbol's current center point. I'd like to change the symbol's point of inclusion. Let me know if I'm making any sense.

Thank You

Sure. Use the move node or feed what comes out of the "Get Point on Poly" (at the p port) into a "get xy" node. perform your additions to the x and y coordinates and feed that back into a point 2 node. That's your new coordinate.

  • Like 1
Link to comment

If you always know which direction, you can offset the geometry in the symbol definition to give what you need and not have to make any adjustments in Marionette.

 

For Example, if you know that the symbol should always be located 1 meter to the right and 2 meters above the insertion point, just move the objects in the symbol definition so they are 1 meter right and 2 meters above the 0,0 point in the symbol definition and you will get the offset when you insert the symbol on the poly.

  • Like 1
Link to comment

@Stephan Moenninghoff and @Pat Stanford 

Gentlemen, My script works perfectly when I input any value other than 50'. It's only when I input 50' as the dimension in the "Rectangle width" node that the last point doesn't get created. I have attached my script and images to try an explain this. It seems like there's something that I haven't quite done right. 

Thanks

50' width issue.jpg

52' works well.jpg

algorithm.jpg

Issue with 50'.vwx

Link to comment
  • Vectorworks, Inc Employee
Just now, Aneesh Carvalho said:

@Stephan Moenninghoff That only worked when I input the dimension as 50' but when I input any other dimension, it creates an additional point which I don't want. 

Sorry I don't understand. Do you want the last symbol placed only when you enter 50' and not for any other length?

Link to comment

@Stephan Moenninghoff I want the symbol to be placed on all the points irrespective of the dimension (the dimension can be anything from 6' to infinity). The script works for any dimension except for when the input is 50'. When the input dimension is 50', for some reason, the last point doesn't get created and the symbol doesn't get placed on that point when logically, it should (as it has been working for every other input dimension)

 

50' width issue.jpg

Link to comment

I don't have time to review the code right now, but if this were script rather than Marionette, I would assume this is an issue of (less than) versus (less than or equals).  If the distance is an integer multiple of the spacing and you use less than, then the last point won't be entered. If you use less than or equal then it will.

 

Probably not the best description (depending on code it could be > or >= versus < or <=) but my guess.

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