turn on suggestions

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Close

Visual LISP, AutoLISP and General Customization

- Autodesk Community
- >
- AutoCAD Customization
- >
- Visual LISP, AutoLISP and General Customization
- >
- convert 3d to 2d polylines with same coordinates

Topic Options

- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic to the Top
- Bookmark
- Subscribe
- Printer Friendly Page

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

182 Views, 13 Replies

10-03-1999 01:52 PM

Could someone help me?

I use Auto CAD R14.I have a file drawing (input was dxf file), with lots of

3D polylines, with same X coordinates at each vertex. I need to put them

into 2D polylines with same coordinates. I have a process, but it´s very

slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one by

one to transform them into 2D polylines. Are there a process or a lisp that

transform 3Dpoly (with one same coordinate) into 2Dpoly?

If there are, tell me, please.

Thank you in advance.

Jasmina

P.S. Sorry for bad English

I use Auto CAD R14.I have a file drawing (input was dxf file), with lots of

3D polylines, with same X coordinates at each vertex. I need to put them

into 2D polylines with same coordinates. I have a process, but it´s very

slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one by

one to transform them into 2D polylines. Are there a process or a lisp that

transform 3Dpoly (with one same coordinate) into 2Dpoly?

If there are, tell me, please.

Thank you in advance.

Jasmina

P.S. Sorry for bad English

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-03-1999 07:03 PM in reply to:
*Subotic, Jasmina

Jasmina,

This code +ACI-flats+ACI- selected 3DPolylines, e.g. changes

Z-coordinates of all vertices to zero. If you need X-coords

to be zero just move up 2 semicolons (+ADs-) 2 lines.

Anyway, let me know how it works.

(defun c:3DPoly-flat ( / ss i e eg)

(cond

((setq ss (ssget '((0 . +ACI-polyline+ACI-)(-4 . +ACIAJgA9ACI-)(70 . 8))))

(setq i -1)

(repeat (sslength ss)

(setq e (ssname ss (setq i (1+- i))))

(while (eq (cdr (assoc 0 (setq eg (entget (setq e (entnext

e)))))) +ACI-VERTEX+ACI-)

(entmod (append eg (list (cons 10 (list (car (cdr (assoc 10

eg))) +ADs-Z+AD0-0

(cadr (cdr (assoc 10

eg))) 0.0)))))

+ADs- (entmod (append eg (list (cons 10 (list 0.0 (cadr (cdr

(assoc 10 eg))) +ADs-X+AD0-0

+ADs- (caddr (cdr (assoc 10

eg))))))))

)+ADs-while

)+ADs-repeat

)+ADs-ss

(t (princ +ACIAXA-nNo 3DPolylines selected.+ACI-))

)+ADs-cond

(princ)

)

Best Regards,

Ibro Vehabovic

ibrov+AEA-flash.net

Jasmina Subotic wrote in message +ADw-7t8g00+ACQ-nac4+AEA-adesknews2.autodesk.com+AD4-...

+AD4-Could someone help me?

+AD4-I use Auto CAD R14.I have a file drawing (input was dxf file), with lots of

+AD4-3D polylines, with same X coordinates at each vertex. I need to put them

+AD4-into 2D polylines with same coordinates. I have a process, but it+ALQ-s very

+AD4-slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one by

+AD4-one to transform them into 2D polylines. Are there a process or a lisp that

+AD4-transform 3Dpoly (with one same coordinate) into 2Dpoly?

+AD4-If there are, tell me, please.

+AD4-

+AD4-Thank you in advance.

+AD4- Jasmina

+AD4-P.S. Sorry for bad English

+AD4-

+AD4-

+AD4-

+AD4-

+AD4-

+AD4-

This code +ACI-flats+ACI- selected 3DPolylines, e.g. changes

Z-coordinates of all vertices to zero. If you need X-coords

to be zero just move up 2 semicolons (+ADs-) 2 lines.

Anyway, let me know how it works.

(defun c:3DPoly-flat ( / ss i e eg)

(cond

((setq ss (ssget '((0 . +ACI-polyline+ACI-)(-4 . +ACIAJgA9ACI-)(70 . 8))))

(setq i -1)

(repeat (sslength ss)

(setq e (ssname ss (setq i (1+- i))))

(while (eq (cdr (assoc 0 (setq eg (entget (setq e (entnext

e)))))) +ACI-VERTEX+ACI-)

(entmod (append eg (list (cons 10 (list (car (cdr (assoc 10

eg))) +ADs-Z+AD0-0

(cadr (cdr (assoc 10

eg))) 0.0)))))

+ADs- (entmod (append eg (list (cons 10 (list 0.0 (cadr (cdr

(assoc 10 eg))) +ADs-X+AD0-0

+ADs- (caddr (cdr (assoc 10

eg))))))))

)+ADs-while

)+ADs-repeat

)+ADs-ss

(t (princ +ACIAXA-nNo 3DPolylines selected.+ACI-))

)+ADs-cond

(princ)

)

Best Regards,

Ibro Vehabovic

ibrov+AEA-flash.net

Jasmina Subotic wrote in message +ADw-7t8g00+ACQ-nac4+AEA-adesknews2.autodesk.com+A

+AD4-Could someone help me?

+AD4-I use Auto CAD R14.I have a file drawing (input was dxf file), with lots of

+AD4-3D polylines, with same X coordinates at each vertex. I need to put them

+AD4-into 2D polylines with same coordinates. I have a process, but it+ALQ-s very

+AD4-slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one by

+AD4-one to transform them into 2D polylines. Are there a process or a lisp that

+AD4-transform 3Dpoly (with one same coordinate) into 2Dpoly?

+AD4-If there are, tell me, please.

+AD4-

+AD4-Thank you in advance.

+AD4- Jasmina

+AD4-P.S. Sorry for bad English

+AD4-

+AD4-

+AD4-

+AD4-

+AD4-

+AD4-

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-03-1999 08:28 PM in reply to:
*Subotic, Jasmina

You would assume big CAD system like ACAD

should have some conversion routines

of this sort built in, but it doesn't.

After all, you're having a planar POLYLINE

here, no matter it's described as 3DPOLY,

right? :-)

May be it's possible to cast a 3dpoly into a 2d

with ARX, I don't know.

But the only option AFAIK is to write

a LISP code:

(defun c:x2d() ; put locals there... )

(setq e (car (entsel))

ds (edlgetsubent e)

d1 (car ds)

vs (cdr ds)

f (cdr(assoc 70 d1))

p0 (get 10 (car vs))

n '(1 0 0)

q0 (trans p0 e n)

z (last q0)

)

(entmake

(append

(list

'(0 . "LWPOLYLINE") '(100 . "AcDbEntity")

(assoc 8 d1)

'(100 . "AcDbPolyline")

(cons 90 (length vs))

(cons 70 (logand 129 f))

(cons 38 z)

)

(if (assoc 48 d1) (list (assoc 48 d1)))

(mapcar '(lambda(d / p q)

(setq p (cdr(assoc 10 d))

q (trans p e n))

(list 10 (car q) (cadr q))) vs)

(list (cons 210 n))

))

(entdel e)

(princ))

I'm _assuming_ all your points here have

equal X coordinates.

If anyone would like to contribute more here,

make it automatically find the plane PLINE

is in, and use 'N accordingly.

A tip (for a few here who need it): it's

easy to find all points of the original

pline with

(setq ps (mapcar

'(lambda(d)(cdr(assoc 10 d))) vs))

Tricky part would be to find if they all belong

to some plane, and to find that plane's normal

vector, then to use it as 'N in the code above. :-)

Tested, :-)

-------

(defun edlgetsubent(en / d dl )

"all ents data, w/out SEQEND"

(setq d (entget en) dl (list d))

(if (= 1 (cdr(assoc 66 d)))

(while (/= "SEQEND"

(cdr(assoc 0 (setq d(entget

(setq en (entnext en)))))))

(setq dl (cons d dl))))

(reverse dl)

)

-------

On Sun, 3 Oct 1999 22:52:40 +0200, "Jasmina Subotic"

wrote:

>Could someone help me?

>I use Auto CAD R14.I have a file drawing (input was dxf file), with lots of

>3D polylines, with same X coordinates at each vertex. I need to put them

>into 2D polylines with same coordinates. I have a process, but it´s very

>slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one by

>one to transform them into 2D polylines. Are there a process or a lisp that

>transform 3Dpoly (with one same coordinate) into 2Dpoly?

>If there are, tell me, please.

---

Vlad http://www.netvision.net.il/php/vnestr/

Splines can be converted into tangential arcs

with arbitrary precision. :-)

should have some conversion routines

of this sort built in, but it doesn't.

After all, you're having a planar POLYLINE

here, no matter it's described as 3DPOLY,

right? :-)

May be it's possible to cast a 3dpoly into a 2d

with ARX, I don't know.

But the only option AFAIK is to write

a LISP code:

(defun c:x2d() ; put locals there... )

(setq e (car (entsel))

ds (edlgetsubent e)

d1 (car ds)

vs (cdr ds)

f (cdr(assoc 70 d1))

p0 (get 10 (car vs))

n '(1 0 0)

q0 (trans p0 e n)

z (last q0)

)

(entmake

(append

(list

'(0 . "LWPOLYLINE") '(100 . "AcDbEntity")

(assoc 8 d1)

'(100 . "AcDbPolyline")

(cons 90 (length vs))

(cons 70 (logand 129 f))

(cons 38 z)

)

(if (assoc 48 d1) (list (assoc 48 d1)))

(mapcar '(lambda(d / p q)

(setq p (cdr(assoc 10 d))

q (trans p e n))

(list 10 (car q) (cadr q))) vs)

(list (cons 210 n))

))

(entdel e)

(princ))

I'm _assuming_ all your points here have

equal X coordinates.

If anyone would like to contribute more here,

make it automatically find the plane PLINE

is in, and use 'N accordingly.

A tip (for a few here who need it): it's

easy to find all points of the original

pline with

(setq ps (mapcar

'(lambda(d)(cdr(assoc 10 d))) vs))

Tricky part would be to find if they all belong

to some plane, and to find that plane's normal

vector, then to use it as 'N in the code above. :-)

Tested, :-)

-------

(defun edlgetsubent(en / d dl )

"all ents data, w/out SEQEND"

(setq d (entget en) dl (list d))

(if (= 1 (cdr(assoc 66 d)))

(while (/= "SEQEND"

(cdr(assoc 0 (setq d(entget

(setq en (entnext en)))))))

(setq dl (cons d dl))))

(reverse dl)

)

-------

On Sun, 3 Oct 1999 22:52:40 +0200, "Jasmina Subotic"

wrote:

>Could someone help me?

>I use Auto CAD R14.I have a file drawing (input was dxf file), with lots of

>3D polylines, with same X coordinates at each vertex. I need to put them

>into 2D polylines with same coordinates. I have a process, but it´s very

>slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one by

>one to transform them into 2D polylines. Are there a process or a lisp that

>transform 3Dpoly (with one same coordinate) into 2Dpoly?

>If there are, tell me, please.

---

Vlad http://www.netvision.net.il/php/vnestr/

Splines can be converted into tangential arcs

with arbitrary precision. :-)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-04-1999 02:14 PM in reply to:
*Subotic, Jasmina

Hello!

Yes, you was perfectly right...but I don't know how to use your code. I

don't understand: "put lockals there...". I didn't put anything. I just

tried your code. But nothing was happen. See what was in AutoCAD Text Window

(I can't select object?):

Command: x2d

Select object: error: null function

(EDLGETSUBENT E)

(SETQ E (CAR (ENTSEL)) DS (EDLGETSUBENT E) D1 (CAR DS) VS (CDR DS) F (CDR

(ASSOC 70 D1)) P0 (GET 10 (CAR VS)) N (QUOTE (1 0 0)) Q0 (TRANS P0 E N) Z

(LAST

Q0))

(C:X2D)

*Cancel*

Best Regards,

Jasmina

Vladimir Nesterovsky wrote in message

news:37fb1ce8.58689936@adesknews.autodesk.com...

> After all, you're having a planar POLYLINE

> here, no matter it's described as 3DPOLY,

> right? :-)

> But the only option AFAIK is to write

> a LISP code:

>

> (defun c:x2d() ; put locals there... )

> (setq e (car (entsel))

> ds (edlgetsubent e)

> d1 (car ds)

> vs (cdr ds)

> f (cdr(assoc 70 d1))

> p0 (get 10 (car vs))

> n '(1 0 0)

> q0 (trans p0 e n)

> z (last q0)

> )

> (entmake

> (append

> (list

> '(0 . "LWPOLYLINE") '(100 . "AcDbEntity")

> (assoc 8 d1)

> '(100 . "AcDbPolyline")

> (cons 90 (length vs))

> (cons 70 (logand 129 f))

> (cons 38 z)

> )

> (if (assoc 48 d1) (list (assoc 48 d1)))

> (mapcar '(lambda(d / p q)

> (setq p (cdr(assoc 10 d))

> q (trans p e n))

> (list 10 (car q) (cadr q))) vs)

> (list (cons 210 n))

> ))

> (entdel e)

> (princ))

>

> I'm _assuming_ all your points here have

> equal X coordinates.

>

Yes, you was perfectly right...but I don't know how to use your code. I

don't understand: "put lockals there...". I didn't put anything. I just

tried your code. But nothing was happen. See what was in AutoCAD Text Window

(I can't select object?):

Command: x2d

Select object: error: null function

(EDLGETSUBENT E)

(SETQ E (CAR (ENTSEL)) DS (EDLGETSUBENT E) D1 (CAR DS) VS (CDR DS) F (CDR

(ASSOC 70 D1)) P0 (GET 10 (CAR VS)) N (QUOTE (1 0 0)) Q0 (TRANS P0 E N) Z

(LAST

Q0))

(C:X2D)

*Cancel*

Best Regards,

Jasmina

Vladimir Nesterovsky

news:37fb1ce8.58689936@adesknews.autodesk.com...

> After all, you're having a planar POLYLINE

> here, no matter it's described as 3DPOLY,

> right? :-)

> But the only option AFAIK is to write

> a LISP code:

>

> (defun c:x2d() ; put locals there... )

> (setq e (car (entsel))

> ds (edlgetsubent e)

> d1 (car ds)

> vs (cdr ds)

> f (cdr(assoc 70 d1))

> p0 (get 10 (car vs))

> n '(1 0 0)

> q0 (trans p0 e n)

> z (last q0)

> )

> (entmake

> (append

> (list

> '(0 . "LWPOLYLINE") '(100 . "AcDbEntity")

> (assoc 8 d1)

> '(100 . "AcDbPolyline")

> (cons 90 (length vs))

> (cons 70 (logand 129 f))

> (cons 38 z)

> )

> (if (assoc 48 d1) (list (assoc 48 d1)))

> (mapcar '(lambda(d / p q)

> (setq p (cdr(assoc 10 d))

> q (trans p e n))

> (list 10 (car q) (cadr q))) vs)

> (list (cons 210 n))

> ))

> (entdel e)

> (princ))

>

> I'm _assuming_ all your points here have

> equal X coordinates.

>

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-04-1999 06:53 PM in reply to:
*Subotic, Jasmina

You missed this function from

my previous post:

-------

(defun edlgetsubent(en / d dl )

"all ents data, w/out SEQEND"

(setq d (entget en) dl (list d))

(if (= 1 (cdr(assoc 66 d)))

(while (/= "SEQEND"

(cdr(assoc 0 (setq d(entget

(setq en (entnext en)))))))

(setq dl (cons d dl))))

(reverse dl)

)

-------

You need to load it too, then use X2D command.

You can ignore the "Put locals there" remark. :-)

On Mon, 4 Oct 1999 23:14:17 +0200, "Jasmina Subotic"

wrote:

>Hello!

> Yes, you was perfectly right...but I don't know how to use your code. I

>don't understand: "put lockals there...". I didn't put anything. I just

>tried your code. But nothing was happen. See what was in AutoCAD Text Window

>(I can't select object?):

>Command: x2d

>

>Select object: error: null function

>(EDLGETSUBENT E)

---

Vlad http://www.netvision.net.il/php/vnestr/

my previous post:

-------

(defun edlgetsubent(en / d dl )

"all ents data, w/out SEQEND"

(setq d (entget en) dl (list d))

(if (= 1 (cdr(assoc 66 d)))

(while (/= "SEQEND"

(cdr(assoc 0 (setq d(entget

(setq en (entnext en)))))))

(setq dl (cons d dl))))

(reverse dl)

)

-------

You need to load it too, then use X2D command.

You can ignore the "Put locals there" remark. :-)

On Mon, 4 Oct 1999 23:14:17 +0200, "Jasmina Subotic"

wrote:

>Hello!

> Yes, you was perfectly right...but I don't know how to use your code. I

>don't understand: "put lockals there...". I didn't put anything. I just

>tried your code. But nothing was happen. See what was in AutoCAD Text Window

>(I can't select object?):

>Command: x2d

>

>Select object: error: null function

>(EDLGETSUBENT E)

---

Vlad http://www.netvision.net.il/php/vnestr/

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-05-1999 09:07 AM in reply to:
*Subotic, Jasmina

Vladimir,

I have just refreshed my "analytical geometry" and look at

what I did. Maybe it is not perfect but it works.

;returns nil if all points do not belong to the same plane

;otherwise returns normal vector of the plane

(defun pts-in-plane ( pts / fuzz x a b c tmp)

(setq fuzz 0.00001)

(command "_.UCS" "_3" (car pts) (cadr pts) (caddr pts)) ;sets UCS through

first 3 points

;should be checked

if points are colinear

(setq x (getvar "UCSXDIR") y (getvar "UCSYDIR")

a (- (* (cadr x) (caddr y)) (* (caddr x) (cadr y))) ;calcs X value

of normal vector

b (- (* (caddr x) (car y)) (* (car x) (caddr y))) ;calcs Y value

of normal vector

c (- (* (car x) (cadr y)) (* (cadr x) (car y))) ;calcs Z value

of normal vector

);setq

(command "_.UCS" "_P")

(foreach x pts

(if (null (equal (+ (* a (- (car x) (car (car pts))))

(* b (- (cadr x) (cadr (car pts))))

(* c (- (caddr x) (caddr (car pts))))) 0.0 fuzz))

(setq tmp T)

);if

);foreach

(if tmp nil (list a b c))

);defun (pts-in-plane)

Here is your modified routine:

;by Vladimir Nesterovsky

(defun c:x2d ( / e ds d1 vs f p0 pts n q0 z p q)

(setq e (car (entsel))

ds (edlgetsubent e)

d1 (car ds)

vs (cdr ds)

f (cdr(assoc 70 d1))

; p0 (get 10 (car vs))

p0 (cdr (assoc 10 (car vs)))

pts (mapcar '(lambda (d) (cdr (assoc 10 d))) vs)

n (pts-in-plane pts)

; if n=nil 3DPoly does not lay in one plane ...

q0 (trans p0 e n)

z (last q0)

);setq

(entmake

(append

(list

'(0 . "LWPOLYLINE") '(100 . "AcDbEntity")

(assoc 8 d1)

'(100 . "AcDbPolyline")

(cons 90 (length vs))

(cons 70 (logand 129 f))

(cons 38 z)

)

(if (assoc 48 d1) (list (assoc 48 d1)))

(mapcar '(lambda(d / p q)

(setq p (cdr(assoc 10 d))

q (trans p e n))

(list 10 (car q) (cadr q))) vs)

(list (cons 210 n))

))

(entdel e)

(princ))

(defun edlgetsubent(en / d dl ) ;"all ents data, w/out SEQEND"

(setq d (entget en) dl (list d))

(if (= 1 (cdr(assoc 66 d)))

(while (/= "SEQEND"

(cdr(assoc 0 (setq d (entget

(setq en (entnext en)))))))

(setq dl (cons d dl))))

(reverse dl)

)

--

Ibro Vehabovic

ibrov@flash.net

Vladimir Nesterovsky wrote in message

news:37fb1ce8.58689936@adesknews.autodesk.com...

> You would assume big CAD system like ACAD

> should have some conversion routines

> of this sort built in, but it doesn't.

> After all, you're having a planar POLYLINE

> here, no matter it's described as 3DPOLY,

> right? :-)

>

> May be it's possible to cast a 3dpoly into a 2d

> with ARX, I don't know.

>

> But the only option AFAIK is to write

> a LISP code:

>

> (defun c:x2d() ; put locals there... )

> (setq e (car (entsel))

> ds (edlgetsubent e)

> d1 (car ds)

> vs (cdr ds)

> f (cdr(assoc 70 d1))

> p0 (get 10 (car vs))

> n '(1 0 0)

> q0 (trans p0 e n)

> z (last q0)

> )

> (entmake

> (append

> (list

> '(0 . "LWPOLYLINE") '(100 . "AcDbEntity")

> (assoc 8 d1)

> '(100 . "AcDbPolyline")

> (cons 90 (length vs))

> (cons 70 (logand 129 f))

> (cons 38 z)

> )

> (if (assoc 48 d1) (list (assoc 48 d1)))

> (mapcar '(lambda(d / p q)

> (setq p (cdr(assoc 10 d))

> q (trans p e n))

> (list 10 (car q) (cadr q))) vs)

> (list (cons 210 n))

> ))

> (entdel e)

> (princ))

>

> I'm _assuming_ all your points here have

> equal X coordinates.

>

> If anyone would like to contribute more here,

> make it automatically find the plane PLINE

> is in, and use 'N accordingly.

>

> A tip (for a few here who need it): it's

> easy to find all points of the original

> pline with

>

> (setq ps (mapcar

> '(lambda(d)(cdr(assoc 10 d))) vs))

>

> Tricky part would be to find if they all belong

> to some plane, and to find that plane's normal

> vector, then to use it as 'N in the code above. :-)

>

> Tested, :-)

>

> -------

> (defun edlgetsubent(en / d dl )

> "all ents data, w/out SEQEND"

> (setq d (entget en) dl (list d))

> (if (= 1 (cdr(assoc 66 d)))

> (while (/= "SEQEND"

> (cdr(assoc 0 (setq d(entget

> (setq en (entnext en)))))))

> (setq dl (cons d dl))))

> (reverse dl)

> )

> -------

>

>

> On Sun, 3 Oct 1999 22:52:40 +0200, "Jasmina Subotic"

> wrote:

>

> >Could someone help me?

> >I use Auto CAD R14.I have a file drawing (input was dxf file), with lots

of

> >3D polylines, with same X coordinates at each vertex. I need to put them

> >into 2D polylines with same coordinates. I have a process, but it´s very

> >slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one

by

> >one to transform them into 2D polylines. Are there a process or a lisp

that

> >transform 3Dpoly (with one same coordinate) into 2Dpoly?

> >If there are, tell me, please.

>

> ---

> Vlad http://www.netvision.net.il/php/vnestr/

> Splines can be converted into tangential arcs

> with arbitrary precision. :-)

I have just refreshed my "analytical geometry" and look at

what I did. Maybe it is not perfect but it works.

;returns nil if all points do not belong to the same plane

;otherwise returns normal vector of the plane

(defun pts-in-plane ( pts / fuzz x a b c tmp)

(setq fuzz 0.00001)

(command "_.UCS" "_3" (car pts) (cadr pts) (caddr pts)) ;sets UCS through

first 3 points

;should be checked

if points are colinear

(setq x (getvar "UCSXDIR") y (getvar "UCSYDIR")

a (- (* (cadr x) (caddr y)) (* (caddr x) (cadr y))) ;calcs X value

of normal vector

b (- (* (caddr x) (car y)) (* (car x) (caddr y))) ;calcs Y value

of normal vector

c (- (* (car x) (cadr y)) (* (cadr x) (car y))) ;calcs Z value

of normal vector

);setq

(command "_.UCS" "_P")

(foreach x pts

(if (null (equal (+ (* a (- (car x) (car (car pts))))

(* b (- (cadr x) (cadr (car pts))))

(* c (- (caddr x) (caddr (car pts))))) 0.0 fuzz))

(setq tmp T)

);if

);foreach

(if tmp nil (list a b c))

);defun (pts-in-plane)

Here is your modified routine:

;by Vladimir Nesterovsky

(defun c:x2d ( / e ds d1 vs f p0 pts n q0 z p q)

(setq e (car (entsel))

ds (edlgetsubent e)

d1 (car ds)

vs (cdr ds)

f (cdr(assoc 70 d1))

; p0 (get 10 (car vs))

p0 (cdr (assoc 10 (car vs)))

pts (mapcar '(lambda (d) (cdr (assoc 10 d))) vs)

n (pts-in-plane pts)

; if n=nil 3DPoly does not lay in one plane ...

q0 (trans p0 e n)

z (last q0)

);setq

(entmake

(append

(list

'(0 . "LWPOLYLINE") '(100 . "AcDbEntity")

(assoc 8 d1)

'(100 . "AcDbPolyline")

(cons 90 (length vs))

(cons 70 (logand 129 f))

(cons 38 z)

)

(if (assoc 48 d1) (list (assoc 48 d1)))

(mapcar '(lambda(d / p q)

(setq p (cdr(assoc 10 d))

q (trans p e n))

(list 10 (car q) (cadr q))) vs)

(list (cons 210 n))

))

(entdel e)

(princ))

(defun edlgetsubent(en / d dl ) ;"all ents data, w/out SEQEND"

(setq d (entget en) dl (list d))

(if (= 1 (cdr(assoc 66 d)))

(while (/= "SEQEND"

(cdr(assoc 0 (setq d (entget

(setq en (entnext en)))))))

(setq dl (cons d dl))))

(reverse dl)

)

--

Ibro Vehabovic

ibrov@flash.net

Vladimir Nesterovsky

news:37fb1ce8.58689936@adesknews.autodesk.com...

> You would assume big CAD system like ACAD

> should have some conversion routines

> of this sort built in, but it doesn't.

> After all, you're having a planar POLYLINE

> here, no matter it's described as 3DPOLY,

> right? :-)

>

> May be it's possible to cast a 3dpoly into a 2d

> with ARX, I don't know.

>

> But the only option AFAIK is to write

> a LISP code:

>

> (defun c:x2d() ; put locals there... )

> (setq e (car (entsel))

> ds (edlgetsubent e)

> d1 (car ds)

> vs (cdr ds)

> f (cdr(assoc 70 d1))

> p0 (get 10 (car vs))

> n '(1 0 0)

> q0 (trans p0 e n)

> z (last q0)

> )

> (entmake

> (append

> (list

> '(0 . "LWPOLYLINE") '(100 . "AcDbEntity")

> (assoc 8 d1)

> '(100 . "AcDbPolyline")

> (cons 90 (length vs))

> (cons 70 (logand 129 f))

> (cons 38 z)

> )

> (if (assoc 48 d1) (list (assoc 48 d1)))

> (mapcar '(lambda(d / p q)

> (setq p (cdr(assoc 10 d))

> q (trans p e n))

> (list 10 (car q) (cadr q))) vs)

> (list (cons 210 n))

> ))

> (entdel e)

> (princ))

>

> I'm _assuming_ all your points here have

> equal X coordinates.

>

> If anyone would like to contribute more here,

> make it automatically find the plane PLINE

> is in, and use 'N accordingly.

>

> A tip (for a few here who need it): it's

> easy to find all points of the original

> pline with

>

> (setq ps (mapcar

> '(lambda(d)(cdr(assoc 10 d))) vs))

>

> Tricky part would be to find if they all belong

> to some plane, and to find that plane's normal

> vector, then to use it as 'N in the code above. :-)

>

> Tested, :-)

>

> -------

> (defun edlgetsubent(en / d dl )

> "all ents data, w/out SEQEND"

> (setq d (entget en) dl (list d))

> (if (= 1 (cdr(assoc 66 d)))

> (while (/= "SEQEND"

> (cdr(assoc 0 (setq d(entget

> (setq en (entnext en)))))))

> (setq dl (cons d dl))))

> (reverse dl)

> )

> -------

>

>

> On Sun, 3 Oct 1999 22:52:40 +0200, "Jasmina Subotic"

> wrote:

>

> >Could someone help me?

> >I use Auto CAD R14.I have a file drawing (input was dxf file), with lots

of

> >3D polylines, with same X coordinates at each vertex. I need to put them

> >into 2D polylines with same coordinates. I have a process, but it´s very

> >slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one

by

> >one to transform them into 2D polylines. Are there a process or a lisp

that

> >transform 3Dpoly (with one same coordinate) into 2Dpoly?

> >If there are, tell me, please.

>

> ---

> Vlad http://www.netvision.net.il/php/vnestr/

> Splines can be converted into tangential arcs

> with arbitrary precision. :-)

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-05-1999 01:25 PM in reply to:
*Subotic, Jasmina

I have something writen about this in http://start.at/autolisp/ including

the case in which the 3d polyline is coplanar, but not parallell to the WCS

XY plane.

The paper is in spanish, but the code will work in any language version.

--

Reinaldo Togores

AutoCAD based CAD - GIS Training & Consulting

Spanish-English Software translation & localization

Jasmina Subotic escribió en el mensaje de noticias

7t8g00$nac4@adesknews2.autodesk.com...

> Could someone help me?

> I use Auto CAD R14.I have a file drawing (input was dxf file), with lots

of

> 3D polylines, with same X coordinates at each vertex. I need to put them

> into 2D polylines with same coordinates. I have a process, but it´s very

> slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one by

> one to transform them into 2D polylines. Are there a process or a lisp

that

> transform 3Dpoly (with one same coordinate) into 2Dpoly?

> If there are, tell me, please.

>

> Thank you in advance.

> Jasmina

> P.S. Sorry for bad English

>

>

>

>

>

>

the case in which the 3d polyline is coplanar, but not parallell to the WCS

XY plane.

The paper is in spanish, but the code will work in any language version.

--

Reinaldo Togores

AutoCAD based CAD - GIS Training & Consulting

Spanish-English Software translation & localization

Jasmina Subotic

7t8g00$nac4@adesknews2.autodesk.com...

> Could someone help me?

> I use Auto CAD R14.I have a file drawing (input was dxf file), with lots

of

> 3D polylines, with same X coordinates at each vertex. I need to put them

> into 2D polylines with same coordinates. I have a process, but it´s very

> slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one by

> one to transform them into 2D polylines. Are there a process or a lisp

that

> transform 3Dpoly (with one same coordinate) into 2Dpoly?

> If there are, tell me, please.

>

> Thank you in advance.

> Jasmina

> P.S. Sorry for bad English

>

>

>

>

>

>

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-05-1999 04:43 PM in reply to:
*Subotic, Jasmina

Hello Vladimir!

Thanks! In the meantime Ibro send me your code with this function.He

knows how my knowledge is little and how my English is bad We speak the

same language. Code works just how I ask. But I thought that I can change

UCS, surprise...it works everything in World UCS. I have 3D polylines, with

same Y or Z coordinates at each vertex also...and 5% of planar POLYLINE

which is no parallel with to the WAS planes.Maybe Reinaldo's code could help

I start to learn Spanish

Vladimir Nesterovsky wrote in message

news:37fa5983.39994037@adesknews.autodesk.com...

> You missed this function from

> my previous post:

> You can ignore the "Put locals there" remark. :-)

I can't ignore this Ibro put your name here

Best Regards,

Jasmina

Thanks! In the meantime Ibro send me your code with this function.He

knows how my knowledge is little and how my English is bad We speak the

same language. Code works just how I ask. But I thought that I can change

UCS, surprise...it works everything in World UCS. I have 3D polylines, with

same Y or Z coordinates at each vertex also...and 5% of planar POLYLINE

which is no parallel with to the WAS planes.Maybe Reinaldo's code could help

I start to learn Spanish

Vladimir Nesterovsky

news:37fa5983.39994037@adesknews.autodesk.com...

> You missed this function from

> my previous post:

> You can ignore the "Put locals there" remark. :-)

I can't ignore this Ibro put your name here

Best Regards,

Jasmina

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-05-1999 05:13 PM in reply to:
*Subotic, Jasmina

Hi Ibro,

Here, you've come to the rescue once again! Thanks!

I hope the code will work now as it should. :-)

Good luck,

On Tue, 5 Oct 1999 09:07:58 -0700, "Ibro Vehabovic"

wrote:

>Vladimir,

>I have just refreshed my "analytical geometry" and look at

>what I did. Maybe it is not perfect but it works.

---

Vlad http://www.netvision.net.il/php/vnestr/

-== Let the Corman LISP be with you. ==-

Here, you've come to the rescue once again! Thanks!

I hope the code will work now as it should. :-)

Good luck,

On Tue, 5 Oct 1999 09:07:58 -0700, "Ibro Vehabovic"

wrote:

>Vladimir,

>I have just refreshed my "analytical geometry" and look at

>what I did. Maybe it is not perfect but it works.

---

Vlad http://www.netvision.net.il/php/vnestr/

-== Let the Corman LISP be with you. ==-

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Highlight
- Email to a Friend
- Report Inappropriate Content

10-09-1999 04:36 AM in reply to:
*Subotic, Jasmina

mpedit

All

O(pen)

C(lose)

X(exit)

Jasmina Subotic wrote in message

news:7t8g00$nac4@adesknews2.autodesk.com...

> Could someone help me?

> I use Auto CAD R14.I have a file drawing (input was dxf file), with lots

of

> 3D polylines, with same X coordinates at each vertex. I need to put them

> into 2D polylines with same coordinates. I have a process, but it´s very

> slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one by

> one to transform them into 2D polylines. Are there a process or a lisp

that

> transform 3Dpoly (with one same coordinate) into 2Dpoly?

> If there are, tell me, please.

>

> Thank you in advance.

> Jasmina

> P.S. Sorry for bad English

>

>

>

>

>

>

All

O(pen)

C(lose)

X(exit)

Jasmina Subotic

news:7t8g00$nac4@adesknews2.autodesk.com...

> Could someone help me?

> I use Auto CAD R14.I have a file drawing (input was dxf file), with lots

of

> 3D polylines, with same X coordinates at each vertex. I need to put them

> into 2D polylines with same coordinates. I have a process, but it´s very

> slow. I EXPLODE all the 3dpoly. Then, I have to PEDIT all the lines one by

> one to transform them into 2D polylines. Are there a process or a lisp

that

> transform 3Dpoly (with one same coordinate) into 2Dpoly?

> If there are, tell me, please.

>

> Thank you in advance.

> Jasmina

> P.S. Sorry for bad English

>

>

>

>

>

>

Search This Board

Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.

Showing results for

Post to the Community

Have questions about Autodesk products? Ask the community.

The Knowledge Network

Access a broad range of knowledge to help get the most out of your products and services.

Download & Installation

Getting your Software

Downloads & Upgrades

Serial Numbers & Product Keys

Installation & Licensing

Activation & Registration

Network License Administration

Subscription Management

Sign In / Create Account

Maintenance Subscription Help

Desktop Subscription Help

Cloud Service Subscription FAQ

Announcements

Feel free to drop by our AU topic post and share your plans, plug a class that you're teaching, or simply check out who else from the community might be in attendance. Ohh and don't forgot to stop by the *Autodesk Help | Learn | Collaborate* booths in the Exhibit Hall and meet our community team if you get a chance!

- Privacy | Legal Notices & Trademarks | Report Noncompliance | Site map | © Copyright 2014 Autodesk Inc. All rights reserved

Except where otherwise noted, this work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. Please see the Autodesk Creative Commons FAQ for more information.