Jump to content

Search for code that generate close polyline from a list of lines


Recommended Posts

Posted (edited)

Hello M.R. 

Trying to load this routine I'm getting 

C:\temp\Downloaded-examples\regs2lws.lsp load successfully!
Command: 
Error: incorrect type - nil
Command: 

Any idea what I missed?

Edited by bah026
  • 2 months later...
Posted

The problem is when I try to create a region , for example on the simple drawing, I'm getting only one region , where I have 3 regions, Region1=V1,V2,V3, V1 Region 2=V2,V4,V5, V3, V2 and Region 3=V1, V2, V4, V5, V3, V1. 

Shap-1.jpg

Posted

Can you post DWG with explanation what's going wrong... Before and expected result would be nice... REGION command applied on your picture should create 3 regions, so after you select them, routine should convert all 3 regions to 3 lwpolylines...

Posted

See the attached dwg,

When I select Region command and select all the lines in the drawing  I only get 1 Region and not 3 as I expacted.

The main goal is to get a close Polyline from the the lines that have an interesection point.

Attached example drawing that I'm working on, of course the real needis to generate a polylines from big drawing with many lines in it.

 

Thanks for your help

Drawing2.dwg

Posted (edited)

I've just tested your DWG... When I use REGION command and select all lines, CAD creates 3 regions like it's supposed to... For your future guidience I suggest that you check each intersection of many lines by selecting them and then activating grip with move mouse - if you see preview that all connected lines are stretching, then intersection is fine - hit ESC to terminate stretching... You should check each intersection in this manner... Finally you should check if all lines are coplanar - there is no quick solution for 3D orientations, but if all your lines are drawn in 2D in WCS, you can select them all, open properties palette (ctrl+1) and look for starting Z coordinate, ending Z coordinate and delta Z value - if this is 0, then all your lines lie in UCS - WCS; otherwise if you see VARIES value then you should modify your lines - flatten them... Anyway this should be your first checking - coplanarity and then you should check for intersections and correct those lines not stretching when grip moved... If all this is OK, when you use REGION and select them all, all regions should be created... Then you can apply my routine on them to get lwpolylines... I know that this is probably unnecessary as you can do many things with regions just like with lwpolylines, but you can't sweep along regions or extrude by path or loft with regions as shapes... Sometimes reference entities must belong to curves, and regions are not those...

Edited by marko_ribar

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
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
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...