Jump to content

Autocad 2008 - turn simple lines (2D) to 3D lines


Recommended Posts

Posted (edited)

I have an Autocad 2008 drawing with layers that have 2D lines, and I need to change every single one of those lines into 3D polylines.

 

Is there a LSP for this kind of work? Does anyone have any idea how to convert these layers which have 2D lines to layers that have 3D lines?

 

Thank you.

Edited by iuliandonici
  • Replies 28
  • Created
  • Last Reply

Top Posters In This Topic

  • iuliandonici

    10

  • eldon

    5

  • fuccaro

    4

  • ReMark

    4

Posted

How would you convert it without knowing Z1 and Z2 the Z values of the endpoints of each line?

Posted

In AutoCAD all 2D lines are in fact 3D lines that happen to have the z value of 0.

Posted
In AutoCAD all 2D lines are in fact 3D lines that happen to have the z value of 0.

 

from help menu: "A 3D polyline is a connected sequence of straight line segments created as a single object. 3D polylines can be non-coplanar; however, they cannot include arc segments."

 

2d polylines can not be non-coplanar

Posted
2d polylines can not be non-coplanar

 

That is why I mentioned only Lines, as the OP asked about.

 

2d polylines can have a z value, as long as it is the same value throughout. Does this make them 3D?

Posted

Perhaps the OP would give out a little more information, like where will the 3D information be coming from?

Posted
That is why I mentioned only Lines, as the OP asked about.

 

2d polylines can have a z value, as long as it is the same value throughout. Does this make them 3D?

 

When you select polyline from the toolbox you draw a LWPolyline not a 2D Polyline and LWPolylines ony have X and Y coordinates. LWPolylines can be converted to 2D polylines, I think the command is CONVERT.

 

We use mostly Civil 3D for our 3D work and it has a function to convert 2D Polylines into 3D Polylines, but that doesn't help the OP as it looks as if he's just using AutoCAD. Somewhere I have a VBA that converts 2D Polys to 3D Polys, if any body wants it.

Posted
That is why I mentioned only Lines, as the OP asked about.

 

2d polylines can have a z value, as long as it is the same value throughout. Does this make them 3D?

ah, I suppose if I read correctly that would help. Changing from line to 2d polyline is a simple step of Pedit. I don't know what to do after that.

Posted

There is at least one lisp routine I know of that converts a 2Dpolyline to a 3Dpolyline.

Posted (edited)

I would like to thank all of you but this is not what I need. My lines don't have any arcs, there are not (2D) polylines. What I need is probably a routine that knows how to convert a layer full of 2D lines into 3D polylines - I can't stay and select every single 2D line because I have thousands of them on each layer (around 5 layers) so I need something consistent.

 

Please, it would mean a lot to me and as frustrating as it is, my job is on the line.

 

The thing is, I was asked to work on a 3D project, drawing some cable trays. It was told to me, I just have to draw some lines. That sounded pretty ok to me so I started drawing line for about two weeks. Now, I've been told my drawing will somehow be exported and used in another program that doesn't know how to "scan" for simple (2D) lines, ONLY 3D polylines. I have searched over the web, nothing so far. There are more 3D to 2D LISP routines out there but those are not helping me.

Edited by iuliandonici
3D poylines, 2d lines, 2D to 3D polylines routine
Posted (edited)

Iulian

 

Try this quick and dirty Lisp routine. There is no layering and it will delete the initial lines. Make a copy of your drawing before you use this Lisp.

(defun c:ltp()
(setq ss (ssget "X" '((0 . "LINE"))))
(repeat (setq i (sslength ss))
(setq e (ssname ss (setq i (1- i))) el (entget e))
(setq a (cdr (assoc 10 el)) b (cdr (assoc 11 el)))
(command "3dpoly" a b "")
(entdel e)
)
)

I don't have AutoCAD right now, I gave it a quick test in Bricscad.

 

I forgot this: TURN OFF THE OSNAP PRIOR TO USE IT !!!

Edited by fuccaro
adding Osnap warning
Posted

What's the command? :"> . Sorry, I've just seen it. I'll put some feedback in a minute.

Posted

@fuccaro: Ok. So, I have loaded the lisp, typed "3dpoly" and it says to pick a starting point and then a second point and that's it. But I don't want to CREATE a 3D Polyline. I just need to convert the 2D ones into 3Ds. Or, maybe I don't know how to use your lisp properly. Where could I be wrong?

Posted

I have bumped into GEOTOOLS. This piece of software does EXACTLY what I wanted. THe only disapointing thing is that it's not FREE and it has a limited uses of its commands.

Posted (edited)

The command 3Dpoly is the AutoCAD tool which creates a 3D polyline one point at a time which is patently what you wish to avoid.

 

There are lisps available by searching the Forum, which will convert into 3D polylines, but then you will have a 3D polyline with a z value of zero.

 

Perhaps that is what you want, but for most people, the whole point of making a 3D polyline is to have something which is in 3D and not just along zero. :shock:

Edited by eldon
Posted
What's the command? :"> . Sorry, I've just seen it. I'll put some feedback in a minute.

 

The command for fuccaro's lisp routine is NOT 3Dpoly. It is the three letters that appear after defun c: which happens to be lpt. Try again.

Posted

@ReMark: I'm just dumb. Thank you.

@fuccaro

Command: 3dpoly
Specify start point of polyline:
Specify endpoint of line or [undo]:
Specify endpoint of line or [undo]:
Command: 3dpoly
Specify start point of polyline:
Specify endpoint of line or [undo]:
Specify endpoint of line or [undo]:
Command: 3dpoly

And I thought I was on the right track. The thing is, this routine has converted indeed my 2D lines to 3DPolylines but it also converted my 5 layers into 1 layer (the default layer). I can't use it. I need my layers to be intact, same names, colors.

Posted

In other words, don't give you what you asked for. Give you what you need?

 

You can't run the routine one layer at a time and freeze the others?

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