Jump to content
Developer Wiki and Function Reference Links ×

Drawing Curtain Tracks with OffsetPolyN and having some issues


Recommended Posts

I have been writing a PIO to draw curtain tracks that we use in film/tv a lot.  It's a 2D Path Object which takes the path, and makes a thicker outline of it, and a 3D track.  Works a lot like the lighting pipe tool and the soft goods tool, but much simpler and faster and has multiple track styles.   I don't know exactly how the lighting pipe tool draws its 2D variant,  but I'm using the OffsetPolyN to offset the main polyline 1" in each direction, then subtracting the shapes from each other.  This seems to work fairly well,  but it can fail if the poly line is open, and I draw in a certain direction because it puts the bigger poly on top.

 

Two questions then...

First, does anyone know how the lighting pipe tool draws its 2D portion?  Because it closes the ends which is nice, and is probably more efficient than my clip surface idea.

 

And second, if not, is there a command that determines the direction a poly line is drawn in so that I can make sure the correct poly ends up on top.  Attached are images showing the end results of drawing the same shape in opposite directions, both open and closed.

 

image.png.1e4394bc89c84671f1ffe8ce79571e89.pngimage.png.96b2745f0c626d3b5ad87121a4f8130e.png

Link to comment

@SamIWas, for the 2D portions of tracks for Soft Goods/SoftGoods 2 I use a combination of OffSetPoly ("left" side), OffSetPolyN ("right" side"), and then GetPolyLineVertex to find the endpoints of each.  I then place lines to "cap" the end points.  The 3D portion then uses those 2 polylines to create new ones within BeginPoly/EndPoly and BeginXtrd/EndExtrd calls.  SetPolyClosed is used to make the resulting polyline closed.

 

I'm sorry, but it has been so long (12 years?) since I coded those parts of that tool that I don't remember why I had to use a combination of OffSetPoly and OffSetPolyN.

 

 

  • Like 1
Link to comment
18 hours ago, VIRTUALENVIRONS said:

Have you considered writing this with NURBS curves instead of Polyline.  That should give you curve direction.

 

If I was doing this manually, it would be NURBS curve>duplicate and move down>Loft surface>Shell thickness.

That's for 3D, right?  The 3D portion is working perfectly.  That was easy with an ExtrudeAlongPath.   It was the 2D I was having trouble with.  But, I got it working!

Link to comment
17 hours ago, C. Andrew Dunning said:

@SamIWas, for the 2D portions of tracks for Soft Goods/SoftGoods 2 I use a combination of OffSetPoly ("left" side), OffSetPolyN ("right" side"), and then GetPolyLineVertex to find the endpoints of each.  I then place lines to "cap" the end points.  The 3D portion then uses those 2 polylines to create new ones within BeginPoly/EndPoly and BeginXtrd/EndExtrd calls.  SetPolyClosed is used to make the resulting polyline closed.

 

I'm sorry, but it has been so long (12 years?) since I coded those parts of that tool that I don't remember why I had to use a combination of OffSetPoly and OffSetPolyN.

 

 

 

I couldn't get your method to work, but it did lead me in the right direction, and I got it working!   What I ended up doing was creating an array that stored all the vertex points of the two offset polylines, then created a new polyline using all of the points into a single object.  Took a LOT of experimenting, but it appears to work now.  Next thing is to work this into a separate procedure/function that can be called multiple times to create 1, 2, and 3-track versions from a single poly.

 

image.thumb.png.fb62d049ba7fdf2ffa3618ecee614879.png

Edited by SamIWas
  • Like 2
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...