Lisp to hide only dimension layers inside a closed polyline, not outside

Lisp to hide only dimension layers inside a closed polyline, not outside

kkntd123
Participant Participant
481 Views
8 Replies
Message 1 of 9

Lisp to hide only dimension layers inside a closed polyline, not outside

kkntd123
Participant
Participant

Hello, I need help to be able to hide the dimension layers inside a closed polyline, in this case it would be the green rectangle

Before:

kkntd123_0-1675107633963.png

 

after:

kkntd123_1-1675107690947.png

 

 

i was trying with :

(defun c:SWCC (/ _pac add ss i e temp it o a b pts tempC i3 ec)

 ;; Select Within/Crossing Curve

 ;; Alan J. Thompson, 03.31.11 / 05.11.11

 

 (vl-load-com)

 

 (defun _pac (e / l v d lst)

   (setq d (- (setq v (/ (setq l (vlax-curve-getDistAtParam e (vlax-curve-getEndParam e))) 100.))))

   (while (< (setq d (+ d v)) l)

     (setq lst (cons (trans (vlax-curve-getPointAtDist e d) 0 1) lst))

   )

 )

 

 (initget 0 "Crossing Within")

 (setq *SWCC:Opt*

        (cond ((getkword (strcat "\nSpecify selection method witin curve [Crossing/Within] <"

                                 (cond (*SWCC:Opt*)

                                       ((setq *SWCC:Opt* "Crossing"))

                                 )

                                 ">: "

                         )

               )

              )

              (*SWCC:Opt*)

        )

 )

 

 (princ "\nSelect closed curves to select object(s) within: ")

 (if (setq add (ssadd)

           ss  (ssget '((-4 . "<OR")

                        (0 . "CIRCLE,ELLIPSE")

                        (-4 . "<AND")

                        (0 . "*POLYLINE")

                        (-4 . "&=")

                        (70 . 1)

                        (-4 . "AND>")

                        (-4 . "OR>")

                       )

               )

     )

   (progn (repeat (setq i (sslength ss))

            (if (setq temp (ssget "_WP" (_pac (setq e (ssname ss (setq i (1- i)))))))

              (repeat (setq i2 (sslength temp)) (ssadd (ssname temp (setq i2 (1- i2))) add))

            )

 

            (if (eq *SWCC:Opt* "Crossing")

              (progn (vla-getboundingbox (setq o (vlax-ename->vla-object e)) 'a 'b)

                     (setq pts (mapcar 'vlax-safearray->list (list a b)))

                     (if (setq tempC (ssget "_C"

                                            (list (caar pts) (cadar pts) 0.)

                                            (list (caadr pts) (cadadr pts) 0.)

                                     )

                         )

                       (repeat (setq i3 (sslength tempC))

                         (if (vlax-invoke

                               o

                               'Intersectwith

                               (vlax-ename->vla-object (setq ec (ssname tempC (setq i3 (1- i3)))))

                               acExtendNone

                             )

                           (ssadd ec add)

                         )

                       )

                     )

              )

            )

          )

          (sssetfirst nil add)

          (ssget "_I")

   )

 )

 (princ)

)

 

 

(LINK: https://www.cadtutor.net/forum/topic/60791-select-blocks-inside-or-crossing-polyline/

 

 

I have been trying with this routine changing from block to dimension layer, but I have not been successful, help 😞 

0 Likes
482 Views
8 Replies
Replies (8)
Message 2 of 9

Kent1Cooper
Consultant
Consultant

@kkntd123 wrote:

Hello, I need help to be able to hide the dimension layers inside a closed polyline....

....

I have been trying with this routine changing from block to dimension layer, ....


I don't see anything in what you "have been trying" about either Blocks or Layers, so it's hard to know what you're really trying to do.  But a Layer is not something that can be selected by (ssget) -- only objects.  Are you looking for all Dimension objects inside [or maybe partially inside?], and then you want to turn off the Layer(s) they are on?  Are there not other Dimensions on the same Layer(s), that would also then become "hidden"?  Or do you want to hide the Dimension objects found, regardless of Layer, but not any non-qualifying Dimensions even on the same Layer(s)?  Or something else?

Kent Cooper, AIA
0 Likes
Message 3 of 9

kkntd123
Participant
Participant

Excuse me, I only put the routine that I was trying to modify from. Actually, it is only necessary to hide only the dimensions layers, nothing else, select a polyline and hide all the dimensions inside them

0 Likes
Message 4 of 9

Kent1Cooper
Consultant
Consultant

@kkntd123 wrote:

... it is only necessary to hide only the dimensions layers, .... select a polyline and hide all the dimensions inside them


Those are two different things.  To "hide" a Layer would mean to turn it off or freeze it.  To "hide" an object such as a Dimension is entirely different.  You haven't answered the question about whether "hiding" a Layer that some Dimension is on will also "hide" Dimensions that you do not want hidden, because they are on the same Layer.

Kent Cooper, AIA
0 Likes
Message 5 of 9

Sea-Haven
Mentor
Mentor

Like Kent need to change the layer the internal dims are on so can off or freeze. maybe layer name like "DIMS-2"

 

kkntd123 you could do a wipeout also but need to move non dims in draw order to top. You can move the wipeout up and down in the draw order or remove so dims are exposed again. 

 

Using wipeout select rectang, polyline, keep, draworder, last, Enter, back, draworder, select dims, Back.

0 Likes
Message 6 of 9

CADaSchtroumpf
Advisor
Advisor

And simply using "_QSELECT" filtering on the dimensions and possibly the layer.
Click on the selection icon (not to apply to the entire drawing).
The selection mode could be individual, capture, window with SHIFT to remove or CTRL to add.
Once all the desired objects have been selected, use "_HideObjects" to make them disappear and then "_UnIsolateObjects" to make them reappear.

0 Likes
Message 7 of 9

Kent1Cooper
Consultant
Consultant

@CADaSchtroumpf wrote:

.... use "_HideObjects" ....


That will not survive after closing the drawing, so the question arises:  @kkntd123, is the idea to hide things in some way that is "permanent" until something is done to un-hide them?  Something like a Wipeout or turning a Layer off?  Or is it sufficient to hide things temporarily, knowing that when you next open the drawing they will no longer be hidden?  EDIT:  It turns out that not surviving after closing the drawing is the default, but in fact you can make such hiding persistent, using the OBJECTISOLATIONMODE System Variable.

Kent Cooper, AIA
Message 8 of 9

CADaSchtroumpf
Advisor
Advisor

@Kent1Cooper  a écrit :

@CADaSchtroumpf wrote:

.... use "_HideObjects" ....


 EDIT:  It turns out that not surviving after closing the drawing is the default, but in fact you can make such hiding persistent, using the OBJECTISOLATIONMODE System Variable.


@Kent1Cooper 

With AutoDesk, variables have taken on the size of an encyclopedia.
I discovered this...
I think it would be good if in the help of the commands, it is notified the variables that can impact this one.
Thank you anyway!

0 Likes
Message 9 of 9

Kent1Cooper
Consultant
Consultant

@CADaSchtroumpf wrote:

....
I think it would be good if in the help of the commands, it is notified the variables that can impact this one.
....


They do have that, in a slightly indirect way.  For example, in the Help entries for ISOLATEOBJECTS, HIDEOBJECTS and UNISOLATEOBJECTS, the list of Related References includes:

Kent1Cooper_1-1675177222063.png

If you pick on that, you get a list of not only Commands but also relevant System Variables [including OBJECTISOLATIONMODE].

Kent Cooper, AIA
0 Likes