# 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

Perhaps convert the line to a poly and use Objects:Poly:2d:GetPointOnPoly.

@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:

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.

@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

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.

@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

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.

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.

@Stephan Moenninghoff Thanks a lot for your suggestion but for what I am trying to achieve, @Pat Stanford  suggestion really worked perfectly for me. I really appreciate all the help from both of you, to a marionette newbie like me. Cheers!

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

2 hours ago, Aneesh Carvalho said:

the last point doesn't get created.

You need to add one here. I think that does it. I haven't tested it much but it worked with your suppplied file.

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

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?

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)

Gotcha. Try this. Does this work?

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.

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

×   Pasted as rich text.   Restore formatting

Only 75 emoji are allowed.

×   Your previous content has been restored.   Clear editor

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

×