PDA

View Full Version : Isolate Objects by USC



CADdancer
2004-07-02, 08:43 PM
Hello to All AUGI Members:

I have a question that might be a first for AutoCAD users.

We are using AutoCAD Architectural Desktop 2005 and I would like to know if objects such as blocks, lines, text, circles etc, placed on the drawing while in various UCS's can be identified either by isolating or filtering of some kind.

It would be great if blocks inserted while in UCS system "A" can be identified or isolated from blocks that were inserted while in UCS system "B" or even blocks that were inserted in the "World" UCS system.

Does anyone know if this can be done...??

Any help with this matter would be appreciated.

Regards,
Vince

dbroad
2004-07-03, 02:23 PM
AFAIK objects do not retain their parent UCS. Blocks have insertion
points x, y, and z. In general, data is translated to ECS (which is
normally WCS).

To search for rotated objects, filter on rotation, where applicable.
To search for objects at a different elevation, filter on their
insertion points or endpoints and look for elevation

For elevation z = 2.0
(setq ss (ssget "x" '((-4 . "*,*,=")(10 0.0 0.0 2.0))))

You can also filter on the extrusion vector.

peter
2004-07-04, 03:43 PM
OK if you would like to isolate objects by named UCS coordinate systems within a drawing I cooked this application.



(defun ssgetUCS (strUCSName / lstOrigin lstXVector lstYVector lstNormal objUCS)
(setq objUCS (vla-item (vla-get-usercoordinatesystems
(vla-get-activedocument
(vlax-get-acad-object)
)
)
strUCSName
)
)
(setq lstOrigin (vlax-safearray->list (variant-value (vla-get-origin objUCS)))
lstXVector (vlax-safearray->list (variant-value (vla-get-XVector objUCS)))
lstYVector (vlax-safearray->list (variant-value (vla-get-YVector objUCS)))
lstNormal (normal lstXVector lstYVector)
)
(if lstNormal
(ssget "x" (list (cons 210 lstNormal)))
)
)
(defun Normal (lst1 lst2)
(list
(- (* (cadr lst1) (caddr lst2))(* (caddr lst1)(cadr lst2)))
(- (* (caddr lst1)(car lst2)) (* (car lst1) (caddr lst2)))
(- (* (car lst1) (cadr lst2)) (* (cadr lst1)(car lst2)))
)
)


So if you had a named use called "fred" you could select objects on the ucs system with the following expression

(ssgetUCS "fred")

Hope it helps


Peter Jamtgaard