Jump to content
benhubel

Brush Select/Circle Select?

Recommended Posts

benhubel

In Blender 3D, there is a circle select tool (formerly brush select) that allows you to paint your selection as if using a brush in Photoshop. After extensive searches, I can't find anything like it in Autocad.

Is there anything like this out there already, or will I need to draft it up myself? Any tips on how to do it would be awesome. Is there a tool that lets you click and drag to dynamically create a polyline or spline (sort of like a fence select where you hold your click)? I could possibly hack together some code onto that to offset the line with circle end-caps, and then select within curve.

 

 

The Blender circle tool is demonstrated in the second half of this video:

https://youtu.be/WCTuc2Dk-3E?t=2m10s

 

And it's documented here, under circular region:

https://www.blender.org/manual/modeling/meshes/selecting/basics.html

Share this post


Link to post
Share on other sites
Grrr

I think this could be possible, but very hard to achieve.

Maybe something like this:

1.Draw a circle and stuck it on the cursor

2.Using reactor copy that circle, while moving the cursor

3.Outline the circles, to create contour plines

4.Select everything inside the plines

 

To be honest, for me it looks kinda useless, whats would be the usage of it?

Share this post


Link to post
Share on other sites
benhubel

I like to reduce the number of clicks that I have to make, as well as the thinking required to do it. Imagine I have 50 objects to select, and there other random objects strewn between. Single selecting each would take 50 clicks. Fence selecting each requires I touch each with the line (tougher on small objects). Box select would take many boxes, probably coupled with deselecting things (especially if there are lots of curves). Quick select assumes that my desired selection has attributes that are different from what I want deselected. Chain select requires that they are connected. Using brush select, I could select many arbitrarily placed objects in a few clicks. It's very hard to describe, but the easiest answer is that I'm used to it. I've run into the need enough to make it worth looking for.

Share this post


Link to post
Share on other sites
tombu

Though it's the closest lasso selection wasn't an option in 2004 version. You can also create a selection by layer and object type or by a group of common properties. I've never had a problem selecting objects in the 23 years I've been doing this, you're not doing 3d drawings like that in AutoCAD 2004 are you?

Share this post


Link to post
Share on other sites
Grrr

I'm afraid that you have to describe how it really works, so someone could come up with a logical method for the code to operate. (see the example in my first post)

Share this post


Link to post
Share on other sites
Lee Mac
Though it's the closest lasso selection wasn't an option in 2004 version.

 

Lasso selection was also the first thing that came to my mind - though, as you've noted, since this is only available in recent versions you may need to imitate it.

Share this post


Link to post
Share on other sites
benhubel

First, to clarify, I'm not actually having trouble selecting anything. I am just looking for a more efficient way to select certain things in certain circumstances.

 

tombu - No, I'm not trying to do 3d in 2004 **Shudders**. I experimented with that a while back. I'd rather claw my eyes out. I have Autocad 2016 at home, I just don't have access to it at work. The lasso selection is nice, but still not quite what I'm looking for.

 

Grrr - I am looking to make it work as much like the Blender version as I can. Over the years I've gotten so used to it that it's become a second nature thing to use. It appears at first glance as if your method would work pretty effectively. I think I'll try it first, but I'm a little concerned about it lagging. I don't know enough about to know for sure until I'm finished.

Share this post


Link to post
Share on other sites
benhubel

Quick details of how exactly the Blender version works:

press C to open the tool - the cursor becomes a circle that can be resized by scrolling up (bigger) or down (smaller).

LMB click to select all selectable geometry within the cursor. Dragging the cursor during a click will continue to select extra geometry as it enters the cursor.

MMB click to deselect all selectable geometry within the cursor.

releasing the mouse button does not end the select tool, rather it stays activated until RMB or ESC is pressed. Geometry remains selected after ending the tool with RMB or ESC.

In Blender it selects as you drag it rather than waiting until after the path is done. In Autocad it might be necessary to hold the selecting part until after, but if I can do it live, it would be helpful.

Share this post


Link to post
Share on other sites
Grrr

Well those were my guesses, seeing the video - how it might work on autocad with lisp.

I don't know if others who replied in the thread are blender users (atleast I'm not).

I know that theres a lisp that would select everything inside a polyline, so the first part would be to construct one(or more), similar to the video and then perform the selection.

Share this post


Link to post
Share on other sites
benhubel

Here's my basic pseudo-code. I'm sure there are critical flaws, as well as crazy inefficiencies. Where would I go looking to figure out how to implement this? Links to Lisp routines that include similar things are welcome. I know how to draw and select within circle, but I'm lost with everything else.

 

(defun C:CSel)

Draw cursor as circle with x? radius ;for visual aid
If Scroll up, increase circle radius by 2%
If Scroll down, decrease circle radius by 2%
If LMB is pressed
    while LMB is pressed
         if cursor moves a distance equal to 5% of the circle radius
              draw temp circle at cursor position
              add everything within temp circle (both fully and partially) to selection
              delete temp circle
If MMB is pressed
    while MMB is pressed
         if cursor moves a distance equal to 5% of the circle radius
              draw temp circle at cursor position
              remove everything within temp circle (both fully and partially) from selection
              delete temp circle
If RMB is pressed
    Return cursor to normal
    End routine

Share this post


Link to post
Share on other sites
marko_ribar

Here it is, quick and dirty...

 

(defun c:cisel ( / *error* *adoc* 5px gr f ff k r n p pl ci cix s ss )

 (vl-load-com)

 (defun *error* ( msg )
   (if (entget ci)
     (entdel ci)
   )
   (vla-endundomark *adoc*)
   (if msg
     (prompt msg)
   )
   (princ)
 )

 (setq *adoc* (vla-get-activedocument (vlax-get-acad-object)))
 (vla-startundomark *adoc*)
 (setq 5px (* 5 (/ (getvar 'viewsize) (cadr (getvar 'screensize)))))
 (prompt "\n\"-\" reduce circle; \"+\" increase circle; left mouse click - brush down, second click - brush up; right mouse click - deselecting mode\nESC - finish")
 (while (or (= 5 (car (setq gr (grread t 5 1)))) (= 2 (car gr)) (= 3 (car gr)) (= 11 (car gr)) (= 25 (car gr)))
   (if ci
     (setq cix (entget ci))
   )
   (cond
     ( (= (car gr) 3)
       (if (null f)
         (setq f t ff nil)
         (setq f nil ff nil)
       )
     )
     ( (or (= (car gr) 11) (= (car gr) 25))
       (if (null ff)
         (setq ff t f nil)
         (setq ff nil f nil)
       )
     )
   )
   (if (null k)
     (setq k 3)
   )
   (cond
     ( (equal gr (list 2 (ascii "+")))
       (setq k (1+ k))
     )
     ( (equal gr (list 2 (ascii "-")))
       (setq k (1- k))
       (if (zerop k)
         (setq k 1)
       )
     )
   )
   (setq r (* k 5px))
   (if (and ci (or (equal gr (list 2 (ascii "+"))) (equal gr (list 2 (ascii "-")))))
     (setq cix (subst (cons 40 r) (assoc 40 cix) cix))
   )
   (setq n -1)
   (if (= (car gr) 5)
     (progn
       (repeat 36
         (setq p (polar (cadr gr) (* (setq n (1+ n)) (/ pi 18)) r))
         (setq pl (cons p pl))
       )
       (if (null ci)
         (setq ci (entmakex (list '(0 . "CIRCLE") (cons 10 (cadr gr)) (cons 40 r) '(62 . 2))))
         (setq cix (subst (cons 10 (cadr gr)) (assoc 10 cix) cix))
       )
     )
   )
   (if pl
     (progn
       (if (setq s (ssget "_CP" pl))
         (if ci
           (ssdel ci s)
         )
         (setq s (ssadd))
       )
       (if (/= (sslength s) 0)
         (progn
           (setq cix (subst (cons 62 1) (assoc 62 cix) cix))
           (cond 
             ( f
               (setq ss (acet-ss-union (list s ss)))
             )
             ( ff
               (setq ss (acet-ss-remove s ss))
             )
           )
         )
         (setq cix (subst (cons 62 2) (assoc 62 cix) cix))
       )
     )
   )
   (cond
     ( f
       (setq cix (subst (cons 62 (+ (cdr (assoc 62 cix)) 2)) (assoc 62 cix) cix))
     )
     ( ff
       (setq cix (subst (cons 62 (+ (cdr (assoc 62 cix)) 4)) (assoc 62 cix) cix))
     )
   )
   (if (and cix (not (equal cix (entget ci) 1e-))
     (entupd (cdr (assoc -1 (entmod cix))))
   )
   (if ss
     (sssetfirst nil ss)
   )
   (setq pl nil)
 )
 (*error* nil)
)

M.R.

Edited by marko_ribar
code little changed - visually better...

Share this post


Link to post
Share on other sites
benhubel

I'm totally lost trying to read this code. It works perfectly though! Thank you.

I'll try to understand how it works and see if I can drop a deselect option in there. Also, I'm mildly amused at how much it floods my console. I remember reading somewhere about a system variable to suppress that?

Share this post


Link to post
Share on other sites
Grrr

Good job, marko!

I've just tested it and It looks pretty satisfying for the OP's request.

Maybe an additional idea (add one more button for a "disselecting" method with that circle?).

Share this post


Link to post
Share on other sites
marko_ribar

Well not, I've just updated it... It had lacks when (redraw ci 3) - highlighting, so I've changed it to change colors...

 

HTH, M.R.

Share this post


Link to post
Share on other sites
marko_ribar

Updated above posted code with deselecting mode...

 

M.R.

Share this post


Link to post
Share on other sites
benhubel

I am in awe of the godlike powers held by marko. Yes, my request is more than satisfied. And not only does it work, it contains a lot of material I can learn from. Thank you.

You guys rock.

Share this post


Link to post
Share on other sites
tombu

Great job Marko, cool application of both grread and acet-ss-union. Avid fan Express Tools functions since they were called Bonus Tools. Added it to my selection tools though I'm not sure how often I'll need it.

Share this post


Link to post
Share on other sites
tombu

I added

(setvar "cmdecho" 0)

before the prompt line. Keeps the prompt options displayed and doesn't add all those Select objects: lines to the Command line history.

Share this post


Link to post
Share on other sites
marko_ribar

Sorry tombu, I have cmdecho set to 0 in acaddoc.lsp so I didn't noticed...

Share this post


Link to post
Share on other sites
tombu
Sorry tombu, I have cmdecho set to 0 in acaddoc.lsp so I didn't noticed...

 

Good idea, adding

(vl-load-com)

to mine years ago saved me from having to add it to every routine since.

Share this post


Link to post
Share on other sites

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
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

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