Visual LISP, AutoLISP and General Customization

## Visual LISP, AutoLISP and General Customization

Active Member
Posts: 8
Registered: ‎02-11-2013
Message 1 of 23 (502 Views)

# Select Arcs by with Normal Z = -1

502 Views, 22 Replies
02-11-2013 07:52 AM

Newbie here trying to learn LISP. My first program is to flip all arcs and circles that have a Normal Z property of -1. But I'm having trouble finding a detailed list of commands and functions for the LISP language that explain creating circles to selecting entities filtered by properties. I must be searching for the wrong terminology.

Any links will be greatly apriciated.

Thx

Bill H.

*Expert Elite*
Posts: 2,639
Registered: ‎12-17-2004
Message 2 of 23 (476 Views)

# Re: Select Arcs by with Normal Z = -1

02-11-2013 12:45 PM in reply to: bhaushalter1

bhaushalter1 wrote:

...

My first program is to flip all arcs and circles that have a Normal Z property of -1. But I'm having trouble finding a detailed list of commands and functions for the LISP language that explain creating circles to selecting entities filtered by properties. I must be searching for the wrong terminology

. ...

Any links will be greatly apriciated

. ...

I do not know what you mean by "flip", but to select arcs and circles with a z value of -1 You can use something like

```(setq	ss (ssget "_X"
(list
'(0 . "CIRCLE,ARC")
'(-4 . "*,*,=")
(cons 10 (list 0.0 0.0 -1.0))
)
)
)```

results in a selection set in the variable ss with all the circles and arcs with z = -1

You can see this site, that is very good to learn lisp, do a google with "AutoLISP" or "AutoLISP tutorials" you'll find several good sites

hope that helps

Henrique

Mentor
Posts: 1,692
Registered: ‎03-14-2004
Message 3 of 23 (462 Views)

# Re: Select Arcs by with Normal Z = -1

02-11-2013 02:37 PM in reply to: bhaushalter1

DXF code 210 hold the vector direction

(210 0.0 0.0 1.0)

positive, from monitor to our face

negative, from our face to the monitor

`(setq -1z-arc&circle  (ssget  "X" (list  (cons 0 "ARC,CIRCLE" )    (cons 210 '( 0 0 -1)))))`

Active Member
Posts: 8
Registered: ‎02-11-2013
Message 4 of 23 (452 Views)

# Re: Select Arcs by with Normal Z = -1

02-11-2013 04:50 PM in reply to: devitg

Thanks for the help Guys.

I get curve data imported form another cad system and some of the arcs have a Z normal of -1. Autocad can't join the curves as a polyline which is required for our laser cutting system.

I think I can run with information given.

Thanks again.

Mentor
Posts: 1,692
Registered: ‎03-14-2004
Message 5 of 23 (446 Views)

# Re: Select Arcs by with Normal Z = -1

02-11-2013 06:23 PM in reply to: bhaushalter1

bhaushalter1  , I do not know what yout lisp do , but when you change the Z vector sign , from 1 to -1  the arc will change its value , as the start and end angle.

See the attached dwg

the red one has Z  1  positive

the black, is the same arc, and  has Z -1 negative ,

so it will not be so easy to flip the arc .

New Member
Posts: 1
Registered: ‎11-20-2012
Message 6 of 23 (434 Views)

# Re: Select Arcs by with Normal Z = -1

02-12-2013 03:46 AM in reply to: bhaushalter1

When you use boundary on the geometriy which has an arc with Z=-1 you will get a closed polyline without that Z=-1

Active Member
Posts: 8
Registered: ‎02-11-2013
Message 7 of 23 (421 Views)

# Re: Select Arcs by with Normal Z = -1

02-12-2013 05:56 AM in reply to: devitg

devitg wrote:

bhaushalter1  , I do not know what yout lisp do , but when you change the Z vector sign , from 1 to -1  the arc will change its value , as the start and end angle.

See the attached dwg

the red one has Z  1  positive

the black, is the same arc, and  has Z -1 negative ,

so it will not be so easy to flip the arc .

My program will select all arcs with a Normal Z of -1 and mirror3d about the XY. All geometry is always flat in the Z plane.

Active Member
Posts: 8
Registered: ‎02-11-2013
Message 8 of 23 (420 Views)

# Re: Select Arcs by with Normal Z = -1

02-12-2013 06:09 AM in reply to: Sjem

Sjem wrote:

When you use boundary on the geometriy which has an arc with Z=-1 you will get a closed polyline without that Z=-1

Didn't seem to work with my geometry. We need a lead in and lead out for the laser which creates crossing curves.

*Expert Elite*
Posts: 5,233
Registered: ‎09-13-2004
Message 9 of 23 (414 Views)

# Re: Select Arcs by with Normal Z = -1

02-12-2013 06:23 AM in reply to: bhaushalter1

bhaushalter1 wrote:
....

My program will select all arcs with a Normal Z of -1 and mirror3d about the XY. All geometry is always flat in the Z plane.

Just Mirroring a Circle or Arc with Z = -1 in the current plane still results in another with Z = -1.  I gave a quick try to Mirror3D, but I must have been misunderstanding how to define the axis, because it didn't work.  But this seems to work, which rotates them about the axis between their center and midpoint, possibly essentially the same thing that MIrror3D does [minimally tested]:

(foreach ent
(mapcar 'cadr (ssnamex (ssget "_X" '((0 . "CIRCLE,ARC") (210 0.0 0.0 -1.0)))))
(command
"_.ucs" "_zaxis"
(trans (cdr (assoc 10 (entget ent))) ent 0); origin
(vlax-curve-getPointAtDist ; Z-direction point [midpoint]
ent
(/
(vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent))
2
); /
); ...getPoint... and UCS
"_.rotate" ent "" "0,0" "180"
"_.ucs" "_previous"
); command
); foreach

Kent Cooper
Mentor
Posts: 1,692
Registered: ‎03-14-2004
Message 10 of 23 (407 Views)

# Re: Select Arcs by with Normal Z = -1

02-12-2013 06:34 AM in reply to: Kent1Cooper

Kent , as ever , your lisp work, ay least at my sample .

Thanks

### You are not logged in.

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.