This is not a Dynamic Block question.
But a short answer: Not included in the basic AutoCAD. In the web you will find any tools (LISP) to solve it. If you ask in another forum again you should give more informations about the "boundary" (one object or several objects, polyline(s) or spline(s) or ellipse (arcs) or lines or mixed of all or ...).
cadder
Jürgen Palme
Did you find this post helpful? Feel free to Like this post.
Did your question get successfully answered? Then click on the ACCEPT SOLUTION button.
Use below lisp code, or just copy paste below code to your cad in F2 window. Then type SIB command. it asks you to select the polyline boundary. Just finished.
;Polyline/circle select - www.cadstudio.cz - www.cadforum.cz
;(use the WPS command or 'WPS inside an object selection prompt)
(defun C:SIB ( / i elist at cmde cen rad p1 impl)
(setq cmde (getvar "cmdecho"))
(setvar "cmdecho" 0)
(setq i 0 elist (entget (car (entsel "\nPick a bounding circle or polyline: "))))
(setvar "OSMODE" (boole 7 (getvar "OSMODE") 16384))
(if (zerop (getvar "CMDACTIVE")) (progn (setq impl T)(command "_select")))
(command "_wp") ; or _CP
(if (= (cdr(assoc 0 elist)) "CIRCLE")
(progn
(setq cen (cdr (assoc 10 elist))
rad (cdr (assoc 40 elist))
)
(repeat 90 ; 360/4 0.06981317=4*pi/180
(setq p1 (polar cen (* i 0.06981317) rad) i (1+ i))
; (command "_POINT" (trans p1 0 1))
(command (trans p1 0 1))
)); else
(repeat (length elist)
(setq at (nth i elist) i (1+ i))
; (if (= (car at) 10) (command (cdr at)))
(if (= (car at) 10) (command (trans (cdr at) 0 1)))
)
);if CIRCLE
(command "")
(setvar "OSMODE" (boole 2 (getvar "OSMODE") 16384))
(setvar "cmdecho" cmde)
(if impl (progn (command "")(sssetfirst nil (ssget "_P"))))
(princ)
)
Do a little Searching. This has come up many times in this Forum alone. You will find a variety of approaches, as well as discussion of possible difficulties [in particular, the effect of arc segments in Polylines as boundaries].
Can that program be modified to select just specific sized circles within the boundary. I am trying to write a program to automatically dimension these circles from the boundary. Thanks
@Lindsay-CAD wrote:
Can that program be modified to select just specific sized circles within the boundary. ....
[Should you be asking this of @Anonymous rather than of me?]
Routines that use (ssget), as many of those I was referring to in suggesting a Search, can filter for entity type and for various other things, including the radius for Circles. I don't think a routine based on a SELECT command, as in Message 3, can do that.
@Lindsay-CAD I would need some more details about your request regarding how you would like your
circles to be selected but try this
(defun c:selectcirclesinside ( / *error* pick_poly take pointlist2d coords eo)
(defun *error* ( msg )
(if (not (member msg '("Function cancelled" "quit / exit abort")))
(princ)
)
(princ)
)
(defun pick_poly ()
(setq e (car(entsel "\nSelect boundary lwpolyline >")))
(if (and (not e) (= (getvar 'Errno) 7)) (pick_poly) e)
)
(defun take (amount lst / ret)(repeat amount (setq ret (cons (car lst) (take (1- amount) (cdr lst))))))
(defun pointlist2d (lst / ret) (while lst (setq ret (cons (take 2 lst) ret) lst (cddr lst))) (reverse ret))
(setq eo (vlax-ename->vla-object (pick_poly)))
(cond
((vlax-property-available-p eo 'coordinates)
(sssetfirst
nil
(ssget
"_CP"
(pointlist2d (vlax-get eo 'coordinates))
(list (cons 0 "CIRCLE") (cons 40 (getreal "\nEnter circle radius > ")))
)
)
)
)
(princ)
)
Miljenko Hatlak
@Lindsay-CAD wrote:
.... I will attach a CAD file as an example. The CAD file is a DXF export .... The Cad file might give you a better picture ....
[Nothing attached]
If you're replying as an email response to an email notification of traffic on your Topic, with something like a cell phone, you can't attach things that way. You need to come to the website in a "real" browser.
Attached is the sample CAD file
Instead of circles inside panel you have inserts (blocks). I understand what you want to achieve and it is not difficult to make a program for this. Lets assume that all objects that have to be dimensioned are block.
1) collect all vertexes of panels and insertion points of all different blocks and retain only unique point i.e remove duplicates
2) on left side and bottom side create create dimensions related to panel size
3) on top and right side create dimensions related to inserted blocks
Creation of block dimensions i.e. right sequence can be defined by user quarry or predefined
I have some program for auto dimensioning and I know @Kent1Cooper has it too. His programs are probably better regarding US dimension units since I predominantly work with SI units
If he can attach his dimensioning script I can make modifications to my code posted above and we can have your program created soon.
You can also start a new post. It will be more interesting to other forum users, and it makes possible for solution creator(s) to receive solution points. In this request attach sample drawing and detailed description of what you want to achieve.
I can work on it during the weekend. Meanwhile you can write how exactly you want your dimensioning program to work as I described above.
Miljenko Hatlak
If there was an admin that could be contacted then your posts and answers could be moved to a new post, that's why Cadtutor is so much better.
Have you talked to Tiltwerks about your requests ? Yes did google.
@hak_vz ,
Of course that raises the age old question of what is meant by "inside."
"CP" can **** the edge of a circle whose center (radius point) is outside the boundary.
"WP" would not include a circle unless the entire circle were inside the boundary.
Same is true for complex things like block references and dimensions and mtext.
Of course for "CP" hatch objects are literally hit or miss. I had a case last Friday where the boundary managed to find its way through a concrete hatch without ever crossing any internal line. The only solution was to temporarily recreate an associative boundary.
Same can happen with "CP" and *TEXT, where the boundary happens to sneak between every character. It's because AutoCAD is looking for visual intersections, not mathematical.
Oh yeah. Same holds true for gaps in dashed linetypes, though LTGAPSELECTION (of which I just learned from @Kent1Cooper ) can help. So a circle with a dashed linetype may not be selected at all with "CP." Hmm, I just remembered that my earliest work included functions for finding mathematical intersections, though not for things like splines or ellipses, which we never used.
John F. Uhden
Wait a second. The SELECT command accepts the methods of "W" "C" "WP" "CP" and "F."
I don't know anything about the relatively new "LASSO."
Oops. My apologies. You were speaking of the SELECT command as not having filtering capabilities. I believe that is correct.
John F. Uhden