Super LIST command

Super LIST command

DC-MWA
Collaborator Collaborator
1,161 Views
12 Replies
Message 1 of 13

Super LIST command

DC-MWA
Collaborator
Collaborator

Hello all,

I've been piecing together "super list" routine. It works great on xref entities (except dimensions)

Doesn't work on non xref objects.

Not sure how to go about making this work. As always, forgive my "frankenlisp" methods.

I have included an image showing what it does and the lisp file is attached.

Capture.JPG

Thank you for any assistance received.

-dc

 

 

0 Likes
1,162 Views
12 Replies
Replies (12)
Message 2 of 13

Kent1Cooper
Consultant
Consultant

It works on non-Xref-nested objects for me.  What happens when you try to use it on such things?

 

[BUT....  The Properties palette tells you all of that and more -- do you need such a routine?]

Kent Cooper, AIA
0 Likes
Message 3 of 13

DC-MWA
Collaborator
Collaborator

Very strange. We just upgraded to windows 10 monday morning. Now after I reboot it does seem to work on non xref items without error message???

It still does not like dimensions??

0 Likes
Message 4 of 13

Kent1Cooper
Consultant
Consultant

@DC-MWA wrote:

... It still does not like dimensions??


 

That's because (nentsel) always "sees" the furthest-down most-deeply-nested rudimentary object that you pick on.  So if you pick on a Block, it could be a Line or a Circle or whatever piece of it that is seen, but never the Block reference itself.  The "nested" objects in Dimensions are Lines, sometimes Arcs, and Points, and Mtext, and whatever pieces the arrowhead Blocks are made of, never the Dimension itself -- for that you need (entsel) rather than (nentsel), but that's not going to help if you're after objects nested in Xrefs, because (entsel) will see the Xref.

 

BUT read up on (nentsel) in the AutoLisp Reference.  There's a way to see the object(s) in which something is nested [see the last paragraph before Remarks].  If something is multiple-nested [you pick on a Line in a Block in an Xref, for example], your challenge will be to determine if possible, for a given pick, what level of object going up the "stack" is the one you want to know about.  You could build something to report on all of them....

Kent Cooper, AIA
0 Likes
Message 5 of 13

DC-MWA
Collaborator
Collaborator

Thank you. I will do some homework.

You mentioned Properties.... Is there a way to see ref object information using properties?

0 Likes
Message 6 of 13

Kent1Cooper
Consultant
Consultant

@DC-MWA wrote:

You mentioned Properties.... Is there a way to see ref object information using properties?


 

I don't think so.  I only mentioned it because you originally said non-Xref objects were what the routine didn't work right on, but if that's not true any more, and you want a single way to report on either kind, Properties won't do.

Kent Cooper, AIA
0 Likes
Message 7 of 13

DC-MWA
Collaborator
Collaborator

Thanks again my friend.

The next challenge to get the area and length of xref items.

0 Likes
Message 8 of 13

Kent1Cooper
Consultant
Consultant

@DC-MWA wrote:

....

The next challenge to get the area and length of xref items.


 

You can do that with the results of (nentsel), within the same limitation of its seeing the deepest-nested object.  This works for me for the area [of things that have  area]:

 

(setq ent (car (nentsel)))

followed by:

(vla-get-Area (vlax-ename->vla-object ent))

 

and this for length:

 

(setq ent (car (nentsel)))

followed by:

(vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent))

 

[That latter works for anything with length, whether open or closed, whereas certain other ways can return 0 for closed objects, and the VLA Properties come with different names for different kinds of things.]

 

BUT those report on the "native" size of nested things, that is, what the area or length will be when the thing they're nested in is at a scale of 1.  If you may have Xref's or Blocks that are scaled otherwise, those won't give you the effective area or length in the current drawing.

Kent Cooper, AIA
0 Likes
Message 9 of 13

DC-MWA
Collaborator
Collaborator

OK I put these two little snippets of code into a test lisp and they work great.

When I try to utilize in my lisp, I do not how to make my "ent" and these items to talk?

 

0 Likes
Message 10 of 13

Kent1Cooper
Consultant
Consultant

@DC-MWA wrote:

OK I put these two little snippets of code into a test lisp and they work great.

When I try to utilize in my lisp, I do not how to make my "ent" and these items to talk?


 

If you mean to prompt you for the selection, read about (nentsel) in the AutoLisp Reference -- it can have a prompt added:

  (setq ent (car (nentsel "\nSelect object to report its length: ")))

 

And to report the results, put the output from:

  (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent))

into a variable and use (alert) as in your original, or (prompt) to send it to the command line.  Or without a variable at all, smply:

  (alert

    (strcat

      "The length of that object is "

      (rtos (vlax-curve-getDistAtParam ent (vlax-curve-getEndParam ent)) 2 2)

      "."

    )

  )

 

Replace the 2's with whatever mode and precision you prefer.

Kent Cooper, AIA
0 Likes
Message 11 of 13

DC-MWA
Collaborator
Collaborator

Good morning.

Thank you so much for assisting me with this. I know my cut and paste notepad methods must make you crazy. 😉

 

Ok I got this working up to the point of length and area.

The issue now is if there is no area of the selected object it gives error message and crashes.

" ActiveX Server returned the error: unknown name: Area"

 

I tried to handle this with an (if (= nil  but it does not work.

The point of this routine is to be able to pick any object and learn as much about as possible.

 

I have attached the current lisp as it is.

You will see my attempts to solve this....

 

 

 

 

0 Likes
Message 12 of 13

DC-MWA
Collaborator
Collaborator

Added quotations in if statement.

Seems to work now.

duh!

0 Likes
Message 13 of 13

ronjonp
Advisor
Advisor

FWIW .. you could wrap your length and area code into an error handler so it won't crash if the object does not have that property.

(defun _length (e)
  (if (= 'real (type (vl-catch-all-apply 'vlax-curve-getendparam (list e))))
    (vlax-curve-getdistatparam e (vlax-curve-getendparam e))
  )
)
(_length (car (entsel)))
(defun _area (e)
  (if (= 'real (type (vl-catch-all-apply 'vlax-curve-getendparam (list e))))
    (vlax-curve-getArea e)
  )
)
(_area (car (entsel)))
0 Likes