XLIST and NCOPY

XLIST and NCOPY

john.uhden
Mentor Mentor
1,222 Views
5 Replies
Message 1 of 6

XLIST and NCOPY

john.uhden
Mentor
Mentor

I am seriously dismayed that these tools provided by AutoCAD are so myopic.  I don't necessarily want to list or copy the line embedded in a light pole block inside an xref.  I want to list or copy the light pole block insertion.

It's not very difficult to show the entire lineage of an object including the line within a block within a block within an xref, but two things are holding me back...

1.  I would like to name the commands different from the AutoCAD commands, but there's no consistency...
XLIST starts with an X, but NCOPY starts with an N.  If they both started with an N or an X, then mine could be the opposite.  Hmm, maybe I'll name them JLIST and JCOPY for my first name, or ULIST and UCOPY for my last name.  Maybe ARGH and BAZONGA would be better.

2.  For XLIST, I would want to show not all but most properties including such as length and area for which I must also include scale.  Anyway, I'm thinking that a regular DCL would not have the room to have enough columns to display all the properties, unless I cut some out.  So, I'm wondering if ObjectDCL would be a solution.  I have never tried it, and I wonder if you can wrap it up into a single .VLX.

Might anyone have some wisdom on this?

John F. Uhden

0 Likes
Accepted solutions (2)
1,223 Views
5 Replies
Replies (5)
Message 2 of 6

Sea-Haven
Mentor
Mentor

maybe something like this it lets you select what properties you want using a list of propeties more can be added.

 

; properties use as a library function
; By Alan H july 2020

(defun cords (obj / co-ords xy )
(setq coordsxy '())
(setq co-ords (vlax-get obj 'Coordinates))
(setq numb (/ (length co-ords) 2))
(setq I 0)
(repeat numb
(setq xy (list (nth (+ I 1) co-ords)(nth I co-ords) ))
(setq coordsxy (cons xy coordsxy))
(setq I (+ I 2))
)
)


(defun AH:chkcwccw (obj / lst newarea)
(setq lst (CORDS obj))
(setq newarea
(/ (apply (function +)
            (mapcar (function (lambda (x y)
                                (- (* (car x) (cadr y)) (* (car y) (cadr x)))))
                    (cons (last lst) lst)
                    l)) 
2.)
)
(if (< newarea  0)
(setq cw "F")
(setq cw "T")
)
)

; Can use reverse in Autocad - pedit reverse in Bricscad.

(defun plprops (obj txt / lst)
(foreach val lst
(cond
((= (strcase val)  "LAY") (setq lay (vla-get-layer obj)))
((= (strcase val) "AREA")(setq area (vla-get-area obj)))
((= (strcase val) "START")(setq start (vlax-curve-getstartpoint obj)))
((= (strcase val) "END" (strcase txt))(setq end (vlax-curve-getendpoint obj)))
((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'Length)))
((= (strcase val) "CW" (strcase txt))(AH:chkcwccw obj))
((= (strcase val) "CORDS" (strcase txt))(CORDS obj))
)
)
)

(defun lineprops (obj lst / )
(foreach val lst
(cond
((= (strcase val)  "LAY") (setq lay (vlax-get obj 'layer)))
((= (strcase val) "START")(setq start (vlax-get obj 'startpoint)))
((= (strcase val) "END" (strcase txt))(setq end (vlax-get obj 'endpoint)))
((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'Length)))
)
)
)

(defun circprops (obj lst / )
(foreach val lst
(cond
((= (strcase val)  "LAY") (setq lay (vlax-get obj 'layer)))
((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'Circumference)))
((= (strcase val) "RAD" (strcase txt))(setq rad (vla-get-radius obj)))
((= (strcase val) "CEN" (strcase txt))(setq cen (vlax-get obj 'Center)))
((= (strcase val) "START")(setq start (vlax-get obj 'startpoint)))
((= (strcase val) "END" (strcase txt))(setq end (vlax-get obj 'endpoint)))
((= (strcase val) "AREA" (strcase txt))(setq end (vlax-get obj 'AREA)))
)
)
)

(defun arcprops (obj txtlst)
(foreach val lst
(cond
((= (strcase val)  "LAY") (setq lay (vlax-get obj 'layer)))
((= (strcase val) "LEN" (strcase txt))(setq len (vlax-get obj 'length)))
((= (strcase val) "RAD" (strcase txt))(setq rad (vla-get-radius obj)))
((= (strcase val) "CEN" (strcase txt))(setq cen (vlax-get obj 'Center)))
((= (strcase val) "START" (strcase txt))(setq area (vlax-get obj 'startpoint)))
((= (strcase val) "END" (strcase txt))(setq area (vlax-get obj 'endpoint)))
((= (strcase val) "AREA" (strcase txt))(setq end (vlax-get obj 'AREA)))
)
)
)

; starts here
(setq ent (vlax-ename->vla-object (car (entsel "Pick Object "))))
; do a check for object type then use defun
; pick an example below


; many examples copy to command line for testing mix and match 
; (plprops ent '("LAY"))(princ lay)
; (plprops ent '("END"))(princ end)
; (plprops ent '("START"))(princ start)
; (plprops ent '("END" "START"))(princ end)(princ start)
; (plprops ent '("AREA" "LAY" "END" "START"))(princ area)(princ lay)(princ end)(princ start)
; (plprops ent '("START" "AREA" "LAY" "CW"))(princ start)(princ area)(princ cw)
; (plprops ent '("start" "END" "CORDS" "cw"))(princ start)(princ end)(princ coordsxy)(princ cw)
; (plprops ent '("CW"))(princ cw)
; (plprops ent '("AREA"))(princ area)
; (plprops ent '("CORDS"))(princ coordsxy)
; (lineprops ent "len"))(princ len)
; (lineprops ent '("len" "lay"))(princ len)(princ lay)
; (lineprops ent '("lay" "end" "start" "len"))(princ len)(princ lay)(princ start)(princ end)
; (circprops ent '("lay" "rad" "area" "cen"))(princ lay)(princ rad)(princ area)(princ cen)
; (circprops ent '("lay" "rad"))
; (arcprops ent '("lay" "rad"))
0 Likes
Message 3 of 6

Moshe-A
Mentor
Mentor
Accepted solution

@john.uhden  hi,

 

 I'm wondering if ObjectDCL would be a solution.  I have never tried it, and I wonder if you can wrap it up into a single .VLX.

Might anyone have some wisdom on this?


This year i did 3 'projects' with OpenDCL and it's great ARX application. easy to learn and use and yes, you can wrap it all into single VLX.

 

Moshe

 

0 Likes
Message 4 of 6

john.uhden
Mentor
Mentor
Ahh, something new to learn!
Thanks, Moshe.

John F. Uhden

0 Likes
Message 5 of 6

Sea-Haven
Mentor
Mentor
Accepted solution

I dont see any real problem in displaying properties in a dcl if you look at my Multi getvals.lsp it is dynamic so you could have as many lines as you want displayed from 1 to around 20, max is to do with screen size. 

 

It uses a simple list for the dcl so number of rows = list a second list would have the value and uses the set_tile to display the value,

 

(setq props (list "This is heading" "ARC" 5 4 "11" "Center"  5 4 "2,2" "Radius" 5 4 "33" "Layer" 15 14 "Arcs"))
(setq ans (AH:getvalsm props))

 So you would just create the "list"  as a strcat of values.

screenshot313.png

0 Likes
Message 6 of 6

john.uhden
Mentor
Mentor

That is a clever idea, Alan.

For "ULIST" I had been thinking of one dialog showing the properties of the entire ancestry, but it could work better by having a list_box that shows each of the ancestors with a button to show the details of the one selected.

For "UCOPY" you need only the list_box with basic data like block name or objectname and layer and IsXref.  Or "UCOPY" could display the properties a la "ULIST" but with a "Copy" button, which means I need only one command function, maybe like "XTRACT" or "XTACY" or "XFILE" but I think Mulder and Scully might disaprove of the last.  Plus I might get ported through some worm hole to our ancient alien ancestors.

John F. Uhden

0 Likes