Jump to content

Recommended Posts

Posted (edited)

Hi,

I have a working subroutine which lists a polyline on a certain layer in a block.
 

;;;------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
;;; Get 4 or 6 x Spudcan Polygon Coordinates at WTG Location
;;;------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
(defun getspudcans ( ss / lst  ent enx )
    (setq lst (vlax-invoke (vlax-ename->vla-object ss) 'Explode))
    (mapcar
        '(lambda (obj)
                (and
                    (= (vla-get-objectname obj) "AcDbPolyline")
                    (= (vla-get-layer obj) "JIV-SC_A")
                    (setq    pts
                        (cons
                            (mapcar 'cdr
                                (vl-remove-if-not
                                    '(lambda (p) (= (car p) 10))
                                    (entget (vlax-vla-object->ename obj))
                                )
                            )
                            pts
                        )
                    )
                )
            )
            lst
    )
    (mapcar 'vla-delete lst)
    (car pts)
)


However I want to list coordinates of objects stored in (possibly) 6 different layers:

("JIV-SC_A"  "JIV-SC_B" "JIV-SC_C" "JIV-SC_D" "JIV-SC_E" "JIV-SC_F")
This object is either a closed LWPOLYLINE or a CIRCLE

Each layer contains max 1 polyline or 1 circle or is empty.

IF object in one of these layers is a CIRCLE then List ((center coordinate) radius)
IF object in one of these layers is a LWPOLYLINE then List (polyline coordinates)

The resulting List must look like:

((list JIV-SC_A) (list JIV-SC_B) (list JIV-SC_C) (list JIV-SC_D))


What is the most efficient way to do this?

Edited by gsc
Posted

Don't know how your defining SS but it would be easier to filter there.

(setq SS (ssget '((0 . "CIRCLE,*POLYLINE") (8 . "JIV-SC_A,JIV-SC_B,JIV-SC_C,JIV-SC_D"))))

run a cond

(= (vla-get-objectname obj) "AcDbPolyline")
or 
(= (vla-get-objectname obj) "AcDbCircle")

 

depending on if its a polyline or circle

(setq lay (vla-get-layer obj))

 

(setq lay (cons ((center coordinate) radius)))

(setq lay (cons (polyline coordinates)))

 

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