Jump to content

Connect points (2D or 3D loci) into lines?


Recommended Posts

How do I select a group of 2D or 3D loci and then create a polyline (or NURBS curve, if 3D) from them?

 

I just want to select a group of properly-arranged 2D or 3D loci (i.e. they are all in a proper linear or curvilinear arrangement, there are no path crossovers or branches) and do something like "Create Line from Points..."  but there is no such command?

 

VW Designer 2021 SP3.1

Edited by Gilbert Osmond
Link to comment
23 minutes ago, Boh said:

I use the 3d polygon tool

 

I know how to use the polygon tool to draw lines by hand.

 

What I want to do is select a group of 3D loci (in this case, a roadway alignment from a survey I just imported) and have Vectorworks automatically connect all the points with a polyline or NURBS curve. If there was a menu command "Connect Points into Line..." I would use that but as far as I can see there is no such command or anything similar.

Link to comment

@Gilbert Osmond I am unaware of a tool in Vectorworks that will do this for you.  In AutoCAD, there was a 3rd party developer that created some tools to do so.  So, I imagine such a tool could be made in Vectorworks using a script or other programming tool, maybe someone has already done this.  Maybe @Pat Stanford knows of something?  Perhaps check the Customization area of the forums.  I could see where this would be handy when dealing with a bunch of points from a surveyor that did not include the centerline of the roadway 🙂

 

Link to comment

Maybe there's some plug-in or 3rd party script that will turn up to help me do this.

 

As a CAD platform that aspires to be survey-ready I find it hard to believe that VW doesn't include this feature as part of its basic functionality.

 

The very nature of survey work is point collection, and it's frequently thousands of points, many of them marking out non-rectilinear 2D features such as paths, roads, irregular garden beds, etc.

 

I spent nearly 1.5 hours since I first posted this question here, laboriously clicking from point.. to point.. to point.. to point.. to point... with the Polyline tool.. to connect over 2,400 roadway survey points from raw survey data that were imported as 3D loci.

Link to comment

Just out of curiosity, what program, other than survey specific processing tools, does this natively?  Neither AutoCAD nor Civil 3D did this last I used them.  I always had to go back to my surveyor and request them to process it for me.  I believe they used Carlson or similar exported to DXF,

Link to comment

Not sure if any do. I am not a licensed surveyor but I do a fair amount of informal surveying using GPS equipment to capture client landscapes. The workflow is easy -- shoot points, download a .CSV file of coordinates, import it into VW, and it's ready to use  -- just need a way to connect dots semi-automatically to expedite linework.

Link to comment

Not sure if this accomplishes anything desired, but ...

The vwx site model (DTM) from 3d loci produces a point to point perimeter, plus the interior topography. If the raw data is somehow delimited, eg if provided with separate layers or classes for roads, beds , creeks, paths, etc, then a separate DTM for each will produce separate perimeters. 
 

and contour interval adjustments might be useful in some way for this 

 

-B

  • Like 1
Link to comment
Just now, Benson Shaw said:

Not sure if this accomplishes anything desired, but ...

The vwx site model (DTM) from 3d loci produces a point to point perimeter, plus the interior topography. If the raw data is somehow delimited, eg if provided with separate layers or classes for roads, beds , creeks, paths, etc, then a separate DTM for each will produce separate perimeters. 
 

and contour interval adjustments might be useful in some way for this 

 

-B

 

That's an interesting round-about way to achieve a similar result. I wonder if it would work for "1-dimensional" site models, i.e. where the "site model" is just a single  line of points with no width (i.e. no cross-slope area.) Maybe I could use this to create 2D figures and then just convert the site model  (in 2D plan view) to lines, and throw away the site model. Roundabout method...

Link to comment
26 minutes ago, Gilbert Osmond said:

Roundabout method...

Totally roundabout.  I was just playing with a work flow to extract the perimeter:

Make the DTM, Edit Crop, Select/Copy the crop (a 2d poly), Exit. Paste in Place. Send to Surface. Result is a Group. Ungroup to reveal a 3d Poly following surface perimeter.

 

The DTM has an algorithm to choose which source points are perimeter and which are interior topo, so all this probably doesn't meet the need. at least I can't make it do just a lasso selection of a curving line.  Oh, well.

 

41 minutes ago, Jesse Cogswell said:

an algorithm to determine a clockwise or anti-clockwise path

Left to right, or screen upward/downward might also be needed if closed path is not desired (eg edge of roadway or path - it never connects to edge at the other side).   But thanks for this script!

 

-B

Link to comment

I suppose I never asked if the polys wanted to be closed or not.  If not, remove the lines with the ClosePoly; procedure and it will generate open polys.  Doing a left to right or down to up sorting of the points wouldn't be terribly difficult, but I don't quite have time to add it right now.  I'll see if I can get to it tomorrow night.

Link to comment
1 hour ago, Jesse Cogswell said:

I could write a script...

...Let me know if this works for you or if this totally breaks something.  It worked in my admittedly brief amount of testing on VW2019, but there's no reason it shouldn't work in VW2021.

 

I just added this to my Resources in VW Designer 2021. An initial test shows that it works pretty well. Thanks very much,  learning to program with Vectorscript exceeds my time/attention budget for the forseeable future.

 

609111276_ScreenShot2021-06-08at9_45_15PM.thumb.jpg.7aa65c0cbb56bd7b31290c741e631123.jpg

 

475602813_ScreenShot2021-06-08at9_45_34PM.thumb.jpg.72b7236a3b405bf8b4efd1ee3b3ea417.jpg

 

317563112_ScreenShot2021-06-08at9_49_05PM.thumb.jpg.11d1b405857b1f3d04d76a3e6ac74fb8.jpg

  • Like 3
Link to comment
9 hours ago, Jesse Cogswell said:

Glad to hear that this worked.  ....

... It's less complicated than what's above but still not all that intuitive.

 

This is fantastic work. If you accept donations via cryptocurrency or some other online tips platform, consider posting it so I can compensate you for what this is worth to me. At least $50 USD.

 

Thanks again & I look forward to ongoing refinements time-permitting.

  • Like 3
Link to comment

I apologize for the delay, last week was a bit rougher than expected.

 

I have fleshed this out a bit more, opening a dialog box allowing you to choose the "direction" of the locus points when producing the polyline, whether or not the polyline is closed, whether or not the source locus points are deleted, and which class and layer the polyline will appear in.  The script also remembers your last choices for direction, closed poly, and delete points to save a little bit of time when running this tool if you don't need to change settings.  Class and layer will always default to the active class and layer when you run the tool.

 

Screenshot of dialog box

image.thumb.png.efc71581369df9d7eedf0d81dbb6fcb8.png

 

The tool is attached as a .zip file.  Installation is mostly painless, but to start, you will want to make sure that if you saved the previous version of the tool using the Plug-in Manager, you will need to make sure to either delete the previous tool or to change the name to something other than Create Poly from Locus Pts.  After doing that, follow the steps below.

  1. Download the attached .zip file to a convenient location.  DO NOT unzip it.
  2. Click Tools - Plug-ins - Plug-in Manager
  3. Click on the Third-party Plug-ins tab
  4. Click on the Install button
  5. Point the Explorer/Finder to the downloaded .zip file
  6. Restart Vectorworks
  7. Add the tool to your workspace following the steps outlined in my previous post.  You will find it under the JNC category.

@Gilbert Osmond , your offer is a pleasant surprise and very well appreciated.  I am a bit conflicted about this, as I answer questions on here as a way to help others navigate the oftentimes opaque documentation from Vectorworks and the usual list of workarounds you sometimes have to use to make Vectorworks fit into different workflows (as someone on here once called "Vectorworkarounds").  I have a large frustration with broken tools and feature requests go unanswered year upon year when it seems that Vectorworks would rather focus on adding half-baked features that often don't work properly out of the box.  This is why I don't mind putting some time toward some of the more "simple" feature requests.  I also enjoy the strict problem solving of programming as a break from my usual work (when time allows).  All that being said, I also won't turn down money, so if you still want to send me a tip, the best bet would be Paypal, and I can DM you the relevant email address.

 

Please let me know if you see anything weird with this tool.  I did some pretty rigorous testing in VW2019 to make sure that stacking order wouldn't interfere with the Left-Right or Top-Down directions, but the algorithm is a bit tricky and there may still be some bugs in it.

Create Poly From Locus Pts.zip

  • Like 1
Link to comment
  • 1 year later...
On 6/9/2021 at 8:53 AM, Jesse Cogswell said:

I could write a script that could pull in the XYZ locations of all selected loci and essentially use that data to "connect the dots" with a 3D polygon, but I think the biggest obstacle to making it work properly is that there is no real way to pull the order in which connect the loci.  Calling a ForEachObject callback would be the most efficient, but it will follow in the order in which the loci were created with little regard to their physical location.  Imagine you wanted to create a square with four loci, A (0,0), B (1,0), C (1,1), and D (0,1).  There's no real easy way to tell the script to create a poly in A,B,C,D order, the script might create a poly in A,C,D,B order, resulting in an hourglass shape.

 

Someone much smarter than me could probably write an algorithm to determine a clockwise or anti-clockwise path between a selection of points, but I can't think of an easy way off the top of my head without attaching a record to each loci with the poly creation order in it, but assigning that would take more time than drawing the polygon by hand.

 

If you can assure that the points are created in the correct order, then the script below should do the trick.

PROCEDURE CreatePolyFromPoints;

{*	Creates a 2D polygon from a selection of 2D Locus points and/or a 3D polygon from a selection of 3D Locus points
	Developed by: Jesse Cogswell
	Date: 6/8/2021
	VW Version: 2019
*}

VAR

	lociPoints:DYNARRAY[] OF POINT;
	lociPoints3D:DYNARRAY[] OF POINT3D;
	numPoints:INTEGER;
	currentLayer:STRING;
	finalPoly,finalPoly3D:HANDLE;
	deleteCheck:BOOLEAN;

PROCEDURE PollThePoints(h:HANDLE);

{Generates array of XY locations of selected points}

	VAR
	
		p1:POINT;

	BEGIN
		numPoints:=numPoints+1;
		ALLOCATE lociPoints[1..numPoints];
		GetLocPt(h,p1.x,p1.y);
		lociPoints[numPoints]:=p1;
		
		IF(deleteCheck=TRUE) THEN DelObject(h);
	END;
	
PROCEDURE PollThePoints3D(h:HANDLE);

{Generates array of XYZ locations of selected 3D points}

	VAR
	
		p1:POINT3D;
		
	BEGIN
		numPoints:=numPoints+1;
		ALLOCATE lociPoints3D[1..numPoints];
		Get3DCntr(h,p1.x,p1.y,p1.z);
		lociPoints3D[numPoints]:=p1;
		
		IF(deleteCheck=TRUE) THEN DelObject(h);
	END;
	
FUNCTION CreatePolygon(points:DYNARRAY[] OF POINT; nPoints:INTEGER) : HANDLE;

{Creates a polygon from given array of points and returns handle to polygon}

	VAR
	
		i:INTEGER;
		h:HANDLE;

	BEGIN
		ClosePoly;
		BeginPoly;
			FOR i:=1 TO nPoints DO AddPoint(points[i].x,points[i].y);
		EndPoly;
		
		CreatePolygon:=LNewObj;
	END;
	
FUNCTION CreatePolygon3D(points:DYNARRAY[] OF POINT3D; nPoints:INTEGER) : HANDLE;

{Creates a 3D polygon from given array of points and returns handle to polygon}

	VAR
	
		i:INTEGER;
		h:HANDLE;
		
	BEGIN
		CLosePoly;
		BeginPoly3D;
			FOR i:=1 TO nPoints DO Add3DPt(points[i].x,points[i].y,points[i].z);
		EndPoly3D;
		
		CreatePolygon3D:=LNewObj;
	END;

BEGIN
	numPoints:=0;
	currentLayer:=GetLName(ActLayer);
	
	deleteCheck:=YNDialog('Delete Locus Points after creation?');
	
	ForEachObject(PollThePoints,((SEL=TRUE) & (L=currentLayer) & (T=LOCUS)));
	IF(numPoints>1) THEN finalPoly:=CreatePolygon(lociPoints,numPoints);
	
	numPoints:=0;
	
	ForEachObject(PollThePoints3D,((SEL=TRUE) & (L=currentLayer) & (T=LOCUS3D)));
	IF(numPoints>1) THEN finalPoly3D:=CreatePolygon3D(lociPoints3D,numPoints);
END;

Run(CreatePolyFromPoints);

The script will follow the points in the order of their creation and gives you an option to delete the locus points afterward.  The script will handle 2D and 3D locus points and will generate accordingly, but separately.  If you include a selection of 2D and 3D points, the script will generate a separate 2D and 3D polygon.  Also keep in mind that it will be restricted to points on the active layer only to prevent it from misreading points still selected on a different layer (in case your Layer Options are set to Show/Snap).

 

Let me know if this works for you or if this totally breaks something.  It worked in my admittedly brief amount of testing on VW2019, but there's no reason it shouldn't work in VW2021.

Works for me in VW 2023.
Many thanks

Link to comment
  • 3 months later...

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