Yancka Posted June 29, 2010 Share Posted June 29, 2010 I'm trying to draw hatch pattern type lines on polygon instead of using hatch itself. It's for use in path PIO. The given data would be: 1. poly handle 2. rotation 3. spacing 4. offset distance from 0 The attached pic represents what I want. It's achieved with hatch. I want to make it with lines. The main confusion is about how to determine where the line should start, where end and what to do in case on same line there are 2 or more lines (other words - the line is interrupted by shape of poly). I've just started working on this and haven't developed any solutions yet. The solution isn't obvious this case, so I'm hoping somebody else might have vision or solution for this. Quote Link to comment
Yancka Posted June 29, 2010 Author Share Posted June 29, 2010 The direction I'm thinking about is GetBBox and LineLineIntersection usage widley. Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted June 29, 2010 Vectorworks, Inc Employee Share Posted June 29, 2010 Hi Yancka, You may want to use CreateStaticHatchFromObject: FUNCTION CreateStaticHatchFromObject(inObj :HANDLE; inHatchName :STRING; pX, pY :REAL; rotationAngle :REAL) :HANDLE; This places a static hatch (inHatchName) within the polygon (inObj) at point (Px, Py) with an angle (rotationAngle). You would still need to have a hatch in the document to use but it'd probably be much faster (and easier) than trying to slice and dice a bunch of lines. If the needed hatch resource is not already in the document, you could create it before inserting it. Then, if desired, the PIO could delete it so the user doesn't see it in the RB). Long long ago I developed a similar approach to what you're proposing (before the CreateStaticHatchFromObject call existed). It would create the array of lines over the polygon (making sure to cover it's BBox), bring the polygon to the front, then Intersect Surface (I think). Not nearly as elegant... Matt Quote Link to comment
Yancka Posted July 1, 2010 Author Share Posted July 1, 2010 Hi Matt, CreateStaticHatchFromObject really does the trick but it requires to mess with hatches in drawing. So I decided not to go with hatches but do a bit more hairy way of combining GetBBox, AddHole and ClipSurface. The result is as desired - 1 contour poly and a bunch of lines. Just I don't yet get how to make out of it what I'm intending (I thought this would be easy from this stage but it isn't). I want to get start point and end point information of each line, delete the line and place linear PIO instead (just 1 level PIO nesting at this point). I don't find a way to get handles of line segments after applying ClipSurface and somehow I'm not succeeding with ForEachObject within my path PIO. But I have all lines selected within my PIO (I can delete them with DeleteObjs call). Any hints on way of cycling through this bunch of lines and converting then into linear PIOs? Quote Link to comment
Vectorworks, Inc Employee Matt Panzer Posted July 3, 2010 Vectorworks, Inc Employee Share Posted July 3, 2010 Hi Yancka, Have you tried creating the lines in a group and giving the group a handle? something like this: BeginGroup; {create all the lines for cutting} EndGroup; GroupHand := LNewObj; { now create a copy of the PIO's path poly and send it into the group } CuttingPolyHand := CreateDuplicateObject( pioPathPolyHand, GroupHand ); { do all your clipping and delete the clipping objects } ForEachObjectInList( Convert2PIOProc, 0, 1, FInGroup( GroupHand ) ); HTH, Matt Quote Link to comment
Recommended Posts
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.