Jump to content

Recommended Posts

Posted

Hi folks

 

Say you have 4 entities named ent(1-4) ent 1 touches ent 2 and ent 3. Ent 4 touches ent 2 and 3.

 

Can anyone suggest a method of turning these into a selection set et without selecting more than one of them. ultimately there would be multiple groups of entities in the drawing

 

Sadly i don't have autocad on this computer so i've resorted to mspaint for a bad quick fix

 

thanks

Ollie

bad example.JPG

Posted

Hi Ollie,

 

If the Express Tools are installed try the Fast Select routine

 

From the menu

 

Express>>Selection tools>>Fast Select

 

or Type FS

 

The sketch was fine!

 

Regards,

 

Jammie

Posted

Although you may have trouble if you want to use Jammie's solution in a LISP, Express Tools are rather hard to manipulate within LISPs... :(

Posted
Hi Ollie,

 

If the Express Tools are installed try the Fast Select routine

 

From the menu

 

Express>>Selection tools>>Fast Select

 

or Type FS

 

The sketch was fine!

 

Regards,

 

Jammie

 

Thanks that is an unbelievably handy tool, unfortunately it's doesn't help me with this thanks though.

 

This is what i have so far difference between this and the expected final is that the user selects one entity at the start rather than find the first non block, 2 point line on the window layer. Also the add to list has a couple of alerts in there place. eventually if these conditions are met the current entity will be added to a selection set containg the connected entities for the first entity.

 

(Defun C:test()

;Cleaning your variables
 (setq temp_ent_dxfgroup nil)

;Load vlax support
 (vl-load-com)

;Begin scriptiong
 (Setq window_id_cntr 0)
 (setq ent_test(car(entsel)))
 (setq ent_test(vlax-ename->vla-object ent_test))
 (setq ent_orientation (vlax-get-property ent_test 'angle))
 (setq ent_length (vlax-get-property ent_test 'length))
 (Setq ent_orientation(angtos ent_orientation 0))        ;Angle in degrees of first object
 (setq ent_orientation(atoi ent_orientation))
 (setq ent_start (vlax-curve-getStartPoint ent_test))        ;Get object start  point
 (if(or (= ent_orientation 0) (= ent_orientation 180))        ;Get orientation of the line horizontal or vertical
   (progn
           (setq  alignment "x")                    ;Use this to determine which axis to set range scope
       (setq static_val (cadr ent_start))
           (setq start_val (car ent_start))
         (if (= ent_orientation 0)
           (progn
             (setq param1 start_val)
                        (setq param2 (+ start_val ent_length))
             )
       )
       (if (= ent_orientation 180)
           (progn
             (setq param1 start_val)
                        (setq param2 (+ start_val ent_length))
             )
       )
   )
 )
 (if(or (= ent_orientation 90) (= ent_orientation 270))
    (progn
           (setq  alignment "y")
           (setq static_val (car ent_start))
           (setq start_val (cadr ent_start))
          (if (= ent_orientation 90)
             (progn
             (setq param1 start_val)
                        (setq param2 (+ start_val ent_length))
             )
         
       )
       (if (= ent_orientation 270)
             (progn
             (setq param1 start_val)
                        (setq param2 (+ start_val ent_length))
             )
       )
   )                                ; the first parameters have been derived now loop through 
 )                                    ; each of the remaining entites 
; first entity parameters defined create selection set and check points against definitions
 (Setq sset_ent (ssget "X"
           '(
             (-4 . "<OR")
             (-4 . "<AND")
             (8 . "Windows")
             (-4 . "AND>")
             (-4 . "<NOT")
             (0 . "INSERT")
             (-4 . "NOT>")
             (-4 . "OR>")
            )
            )
 )
(setq cntr 0)
(while (< cntr (sslength sset_ent))
      (setq temp_ent(ssname sset_ent cntr))
    (setq temp_ent_dxfgroup(entget temp_ent))
    (foreach c  temp_ent_dxfgroup
           (if (= 10 (car c))
                   (setq p_list
                 (append p_list
                 (list
                    (cdr c)
                     )
                )
            )
          )
      )
      (foreach c p_list
       (Setq x_point (car c))
         (Setq y_point(cadr c))
         (if (= alignment "x")
             (progn
                 (if (= y_point static_val)
                          (progn
                       (if (and (>= x_point param1)(<= x_point param2))
                            (alert "WORKING UPTO AND HERE")
                       )
                    )
               )
           )
       )
         (if (= alignment "y")
             (progn
                 (if (= x_point static_val)
                          (progn
                       (if (and (>= y_point param1)(<= y_point param2))
                            (alert "WORKING UPTO HERE")
                       )
                    )
               )
           )
       )
   )
   (Setq cntr (+ cntr 1))        ;exit while loop
)
 
)

This may not explain anything but hopefully it'll give some idea of how i've attacked it.

 

Cheers

Ollie.

 

EDIT:

 

Main problem now is that i'm not getting dxfgroup 11 from lines unfortunately i can't be sure if they will be lines or not. i've tied converting all into individual polylines but that removes the angle property from the vlax-get-property method.

Posted

Why not just limit the user to selecting only lines:

 

(setq ss (ssget '((0 . "LINE"))))

Posted
Why not just limit the user to selecting only lines:

 

(setq ss (ssget '((0 . "LINE"))))

 

Sadly not every drawing this will be used on has been done by myself. Some of the other methods used to draw windows include overlapping lines and rectangles.

Posted
Sadly not every drawing this will be used on has been done by myself. Some of the other methods used to draw windows include overlapping lines and rectangles.

 

Ahh, no worries, just thought I'd put the idea out there :)

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