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

Close

Visual LISP, AutoLISP and General Customization

- Autodesk Community
- >
- AutoCAD Customization
- >
- Visual LISP, AutoLISP and General Customization
- >
- Re: Select Arcs by with Normal Z = -1

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

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.

Solved! Go to Solution.

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

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

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

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

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

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.

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

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 .

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

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

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

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.

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

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

Sjem wrote:

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

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

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

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

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

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

Thanks

Log into access your profile, ask and answer questions, share ideas and more. Haven't signed up yet? Register

Announcements

Start with some of our most frequented solutions to get help installing your software.

Upgrading to a 2015 product? Make sure to check these out 1st!

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