Recent Posts

Pages: 1 2 [3] 4 5 ... 10
21
Thank you, ribarm, Lee, Mac!
I wonder if it can be implemented with ssget?
22
Heres a start (I assumed that you were talking about the block's definition and its definition objects) :

Code - Auto/Visual Lisp: [Select]
  1. ; _$ (BlockRef->VisStatesL  (car (entsel "\nPick block reference: ")))
  2. ; (("VisibilityState0" <Entity name: 9180e75c30> <Entity name: 9180e75c40> <Entity name: 9180e75c50>) ("VisibilityState1" <Entity name: 9180e75c70> <Entity name: 9180e75c60> <Entity name: 9180e75c50>))
  3. (defun BlockRef->VisStatesL ( e / o L )
  4.  
  5.  ; https://www.theswamp.org/index.php?topic=53354.msg580794#msg580794
  6.  (defun SplitListTf ( prd lst / rtn tmp ) ; Lee Mac
  7.    (foreach itm lst
  8.      (if (apply prd (list itm))
  9.        (setq rtn (vl-list* (list itm) (reverse tmp) rtn) tmp nil)
  10.        (setq tmp (cons itm tmp))
  11.      )
  12.    )
  13.    (vl-remove nil (reverse (cons (reverse tmp) rtn)))
  14.  )
  15.  
  16.  (defun GroupN ( n L )
  17.    ( (lambda (f) (f n L))
  18.      (lambda (n L) (cond ( (not L) L) ( (cons ((lambda ( / tmp ) (repeat n (setq tmp (cons (car L) tmp)) (setq L (cdr L))) (reverse tmp))) (f n L)) ) ) )
  19.    )
  20.  )  
  21.  
  22.  (cond
  23.    ( (not e) )
  24.    ( (/= "AcDbBlockReference" (vla-get-ObjectName (setq o (vlax-ename->vla-object e)))) )
  25.    ( (setq o (vla-item (vla-get-Blocks (vla-get-ActiveDocument (vlax-get-acad-object))) (vla-get-EffectiveName o)))
  26.      (and
  27.        (setq L (cdr (assoc 360 (dictsearch (cdr (assoc 360 (entget (vlax-vla-object->ename o)))) "ACAD_ENHANCEDBLOCK"))))
  28.        (setq L (entget L))
  29.        (setq L
  30.          (mapcar '(lambda (x) (vl-remove-if-not '(lambda (xx) (member (type xx) '(str ename))) (mapcar 'cdr (apply 'append x))))
  31.            (GroupN 2 (SplitListTf '(lambda (x) (= 303 (car x))) (vl-member-if '(lambda (x) (= 303 (car x))) L)))
  32.          )
  33.        )
  34.      )
  35.    )
  36.  )
  37.  L
  38. ); defun BlockRef->VisStatesL

So the above returns an assoc list of (<VisParamName> <List of enames>) [car/cdr list accessing], heres a sample test from one of my blocks:

Code - Auto/Visual Lisp: [Select]
  1. _$ (BlockRef->VisStatesL  (car (entsel "\nPick block reference: ")))
  2. (("TOP"
  3.   <Entity name: 9180e31ac0>
  4.   <Entity name: 9180e31b30>
  5.   <Entity name: 9180e31bd0>
  6.   <Entity name: 9180e31be0>
  7.   <Entity name: 9180e31bf0>
  8.   <Entity name: 9180e31c00>
  9.  )
  10.  ("BOTTOM"
  11.    <Entity name: 9180e31af0>
  12.    <Entity name: 9180e31b00>
  13.    <Entity name: 9180e31b70>
  14.    <Entity name: 9180e31b80>
  15.    <Entity name: 9180e31b90>
  16.    <Entity name: 9180e31c10>
  17.   )
  18.  ("RIGHT"
  19.    <Entity name: 9180e31ad0>
  20.    <Entity name: 9180e31ae0>
  21.    <Entity name: 9180e31ba0>
  22.    <Entity name: 9180e31bb0>
  23.    <Entity name: 9180e31bc0>
  24.    <Entity name: 9180e31c20>
  25.   )
  26.  ("LEFT"
  27.    <Entity name: 9180e31b10>
  28.    <Entity name: 9180e31b20>
  29.    <Entity name: 9180e31b40>
  30.    <Entity name: 9180e31b50>
  31.    <Entity name: 9180e31b60>
  32.    <Entity name: 9180e31c30>
  33.   )
  34. )
23
AFAIK, you can't highlight nested entities... You could though try changing color and transparency...
Something like this :

Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt ( / adoc ent lst )
  2.  
  3.  
  4.  (while (setq ent (car (nentsel "\nPick an entity inside the block: ")))
  5.    (setq lst (cons (list ent (vla-get-entitytransparency (vlax-ename->vla-object ent))) lst))
  6.    (foreach a lst
  7.      (vla-put-color (vlax-ename->vla-object (car a)) 1)
  8.      (vla-put-entitytransparency (vlax-ename->vla-object (car a)) 75)
  9.    )
  10.    (vla-regen adoc :vlax-true)
  11.  )
  12.  (foreach a lst
  13.    (vla-put-color (vlax-ename->vla-object (car a)) 6)
  14.    (vla-put-entitytransparency (vlax-ename->vla-object (car a)) (cadr a))
  15.  )
  16.  (vla-regen adoc :vlax-true)
  17.  (princ)
  18. )
  19.  

Cheers...
 :thinking:
24
My lisp, I don't know what's wrong!
25
Is there a question here?
26
Continuous selection  entity inside block,  then select the entity change color

Code - Auto/Visual Lisp: [Select]
  1. (defun c:tt (/ lst ss)
  2. (setq ss (ssadd))
  3. (while (setq Ent (nentsel "\nPick an  entity inside the block: "))
  4.       (setq lst (cons ent lst) ss (ssadd (car ent) ss))
  5.       (sssetfirst nil ss)
  6.  )
  7. (foreach a lst
  8.  (vla-put-Color (vlax-ename->vla-object (car a)) 6)
  9.  )
  10. )


EDIT (John): Added code tags for better display.
27
I have try layers, this way work, but maybe not the best.
28
.NET / Re: Getting all blocks in a drawing based on name.
« Last post by WILL HATCH on September 22, 2017, 07:17:50 pm »
every entity has a property OwnerId which is the block table record which owns it. You can call up the chain of ownership quite quickly this way to access the layer information of the containing block
29
.NET / Re: Cut polyline
« Last post by WILL HATCH on September 22, 2017, 07:05:44 pm »
I can't make time to play, but ;

Next month are you likely to be confused by the variables plL, p1L, p1N  ... and will you remember what they identify ?


Does Normans post help :
http://drive-cad-with-code.blogspot.com.au/2016/12/splitting-polylinecurve-with-autocad.html
There's a serious truth right there!  :2funny:
30
Check the value of DXF group 66.
Pages: 1 2 [3] 4 5 ... 10