Steven P Posted June 21 Posted June 21 Thanks. Got most of it working, or think I know what to change apart from circles crossing the cutting line. Wasn't wanting to use extrim - is it still an express tool so not sure everyone will have it? Quote
Danielm103 Posted June 21 Posted June 21 (edited) you could use a spatial filter (like xclip) if you used a rectangular shape instead of a circle. maybe a hexagon or something Edited June 21 by Danielm103 Quote
SLW210 Posted June 21 Posted June 21 Why not just get AutoCAD Mechanical? It is a FREE specialized toolset. 1 Quote
Danielm103 Posted June 21 Posted June 21 7 hours ago, SLW210 said: Why not just get AutoCAD Mechanical? It is a FREE specialized toolset. It’s a good idea, at least to check it out. It may introduce unwanted custom objects into the drawing though. AmdtDetailSym, and its corresponding style Quote
BIGAL Posted June 22 Posted June 22 Give this a try, I would have preferred to use Extrim but its not working correctly in my Bricscad will send a support request. Make sure you save cookie cutter ina support path or add full path to (load. (defun c:wow ( / ang bname col cpt ent lay lst obj pt pt1 pt2 pts rad) (setq obj (vlax-ename->vla-object (car (entsel "\nPick circle object ")))) (setq cpt (vlax-get obj 'center)) (setq col (vlax-get obj 'color)) (setq rad (vlax-get obj 'radius)) (setq lay (vlax-get obj 'layer)) (setq lst '()) (setq ang 0.0 inc (/ (* 2. pi) 50.)) (repeat 50 (setq pt (polar cpt ang rad)) (setq lst (cons pt lst)) (setq ang (+ inc ang)) ) (setq lst (cons (last lst) lst)) (command "copyclip" (ssget "CP" lst) "") (setq bname (getstring "\nEnter block name ")) (command "Bedit" bname) (command "pasteclip") (command "0,0") (command "zoom" "extents") (setq pt1 (getvar 'extmax)) (setq pt2 (getvar 'extmin)) (setq pts (list pt1 pt2 )) (setq ss (ssget "CP" pts (list (cons 0 "CIRCLE")(cons 8 lay)(cons 40 rad)(cons 62 col)))) (setq ent (ssname ss 0)) (setq cpt (cdr (assoc 10 (entget ent)))) (if (not cookiecutter2)(load "CookieCutter2_v1.0.lsp")) (command "cc") (command "move" "w" pts "" cpt '(0 0)) (command "bclose" "save") (princ) ) (c:wow) CookieCutter2_v1.0.lsp Quote
SLW210 Posted June 22 Posted June 22 14 hours ago, Danielm103 said: ... It may introduce unwanted custom objects into the drawing though... Easy enough to solve. The easiest way is to just use a viewport in a layout, but you can lead a horse to water... 2 Quote
jim78b Posted June 23 Author Posted June 23 thanks to all the help but i see that the thing is difficult, i thought it was easier. i will do it by hand at this point, copying and then exploding the block and then cutting and then scaling. Quote
Danielm103 Posted June 23 Posted June 23 (edited) Forgive the Python, only trying to illustrate one possibility. This code creates a spatial filter for a block reference, to simulate a detail. In the image, I created a block of the room, with two references. One has a spatial filter applied and is scaled. You can do the same in lisp, or by hand, make a copy of the block, run the xclip command, draw your polyline perimeter, set XCLIPFRAME to 1 so you can see your frame. instead of a circle, use a polygon with a shape to your liking. My code still needs work as my transformby is wonky(not centered correctly) and I hand drew the leader line lol import traceback from pyrx import Rx, Ge, Gi, Db, Ap, Ed ACDB_INFINITE_XCLIP_DEPTH = 1.0e300 def addFilter_getmat(refid, filter): ref = Db.BlockReference(refid, Db.OpenMode.kForWrite) Db.IndexFilterManager.addFilter(ref, filter) return ref.blockTransform() @Ap.Command() def doit(): try: db = Db.curDb() _ps, refid, _ = Ed.Editor.entSel("\nSelect ", Db.BlockReference.desc()) _ps, cen = Ed.Editor.getPoint("\nGet center: ") _ps, rad = Ed.Editor.getDist(cen, "\nGet radius: ") carc = Ge.CircArc3d(cen, Ge.Vector3d.kZAxis, rad) pts3d, _params = carc.getSamplePoints(20) filter = Db.SpatialFilter() mat = addFilter_getmat(refid, filter) pts2d = [] for pt in pts3d: pt.transformBy(mat) pts2d.append(Ge.Point2d(pt.x, pt.y)) filter.setDefinition( pts2d, Ge.Vector3d.kZAxis, db.elevation(), ACDB_INFINITE_XCLIP_DEPTH, -ACDB_INFINITE_XCLIP_DEPTH, True, ) except Exception as err: print(err) Edited June 23 by Danielm103 2 Quote
SLW210 Posted June 23 Posted June 23 I worked on a LISP for this yesterday at home, still at it today. Copying and scaling in a circle was easy enough, working on trimming everything today when work allows. I usually use AutoCAD Mechanical for this (usually shaft details which I do in Mechanical) or a View in a Viewport in the Layout Tab, but might be handy to not need to open a drawing in AutoCAD Mechanical and just do it in Modelspace Vanilla AutoCAD. 1 Quote
BIGAL Posted June 23 Posted June 23 Trimming out side use Extrim inside it is (etrim obj pt) just load it 1st that exposes the Etrim defun. Use (getvar 'extmax) for pt. In my Bricscad it odes not work properly hence why in code above use Cookiecutter. Sent a support request to Bricsys for comment. Just copying the objects trim them, then rescale is much easier than making a block of objects. Pick circle, enter desired scale, go to a layout and make correct viewport at desired scale a much better way. 1 Quote
SLW210 Posted June 24 Posted June 24 Tried to use already made solutions to do the trim, with no luck. Cookiecutter deletes everything outside, but works on blocks, EXTRIM, is also not working inside another lisp for me. P.S. Just a thought, some Express Tools are actually called by a different name, could this be the case for EXTRIM? I'm no expert though, currently trying to explode the block, trim everything and reblock. Though maybe the reblock isn't necessary? Quote
SLW210 Posted Tuesday at 03:01 PM Posted Tuesday at 03:01 PM ClipIt (Express Tool) works on blocks, etc. so I got it to work manually. I did do some light reading on automating options in a called Express Tool, so maybe at some point. This works for me, hopefully speeds things up for the OP. Works OP provided .dwg and some quick blocks to test it. ;;; Creates a circular detail clip from a block reference. Copies, scales, and trims to scaled circle (connected by trimmed line). ;;; ;;; https://www.cadtutor.net/forum/topic/98334-detail-circle-in-ms/page/2/#findComment-674313 ;;; ;;;*************************************************************************************************| ;;; | ;;; By SLW210 (a.k.a. Steve Wilson) | ;;; | ;;; MSCirClip.lsp | ;;; | ;;; Uses the Express Tool ClipIt manually (maybe this will be automated at a later time). | ;;; At the prompt-Select the detail circle then select the copied and scaled block. | ;;; At Enter maximum allowable error distance for resolution of arc segments. | ;;; I used 1 and it seems good (smaller is more segments) (see Clipit in Express Tools help). | ;;; | ;;;*************************************************************************************************| ;;; ClipIt creates a pseudo circle of polylines, the connector line will most likely have a gap. | ;;; | ;;; Optionally you could comment the part erasing it. | ;;; | ;;;*************************************************************************************************| ;;; (defun c:MSCIRCLIP (/ ent cen rad circle newPt scaleFactor newRad vec dir pt1 pt2 len scaledBlock detailCircle entsBefore entsAfter diffBlocks ) (vl-load-com) (prompt "\n--- MODELSPACE DETAIL VIEW WITH CLIPIT ---\n") ;; Modelspace entities (defun all-ents () (vl-remove-if 'null (mapcar 'cadr (ssnamex (ssget "_X" '((410 . "Model"))))) ) ) ;; Select block reference (setq ent (car (entsel "\nSelect block reference to detail: "))) (if (not (and ent (= (cdr (assoc 0 (entget ent))) "INSERT"))) (progn (prompt "\nNot a valid block reference.") (exit)) ) ;; Circle center/radius (setq cen (getpoint "\nSpecify center of detail circle: ")) (setq rad (getdist cen "\nSpecify radius of detail circle: ")) (entmakex (list '(0 . "CIRCLE") (cons 10 cen) (cons 40 rad) (cons 62 1) (cons 8 "DETAIL") ) ) ;; Detail location and scale (setq newPt (getpoint "\nSpecify center point for detail view: ")) (initget 7) (setq scaleFactor (getreal "\nEnter detail scale factor (e.g. 2): ")) (setq newRad (* rad scaleFactor)) ;; Copy and scale block (command "COPY" ent "" cen newPt) (setq scaledBlock (entlast)) (command "SCALE" scaledBlock "" newPt scaleFactor) ;; Clipping circle (setq detailCircle (entmakex (list '(0 . "CIRCLE") (cons 10 newPt) (cons 40 newRad) (cons 62 1) (cons 8 "DETAIL") ) ) ) ;; Run CLIPIT manually (prompt "\n>>> Run CLIPIT: Select the detail circle and the new (scaled) block.\n" ) (C:CLIPIT) ;; Delete temp circle after CLIPIT (if (and detailCircle (entget detailCircle)) (entdel detailCircle) ) ;; Draw connector line (setq vec (mapcar '- newPt cen)) (setq len (distance cen newPt)) (setq dir (mapcar '/ vec (list len len len))) (setq pt1 (mapcar '+ cen (mapcar '* dir (list rad rad rad)))) (setq pt2 (mapcar '- newPt (mapcar '* dir (list newRad newRad newRad)) ) ) (entmakex (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2) (cons 62 3) (cons 8 "DETAIL") ) ) (prompt "\nDetail view created and connector drawn.\n") (princ) ) Quote
jim78b Posted Tuesday at 03:34 PM Author Posted Tuesday at 03:34 PM 32 minutes ago, SLW210 said: ClipIt (Express Tool) works on blocks, etc. so I got it to work manually. I did do some light reading on automating options in a called Express Tool, so maybe at some point. This works for me, hopefully speeds things up for the OP. OP never provided a .dwg so I had to make some quick blocks to test it. ;;; Creates a circular detail clip from a block reference. Copies, scales, and trims to scaled circle (connected by trimmed line). ;;; ;;; https://www.cadtutor.net/forum/topic/98334-detail-circle-in-ms/page/2/#findComment-674313 ;;; ;;;*************************************************************************************************| ;;; | ;;; By SLW210 (a.k.a. Steve Wilson) | ;;; | ;;; MSCirClip.lsp | ;;; | ;;; Uses the Express Tool ClipIt manually (maybe this will be automated at a later time). | ;;; At the prompt-Select the detail circle then select the copied and scaled block. | ;;; At Enter maximum allowable error distance for resolution of arc segments. | ;;; I used 1 and it seems good (smaller is more segments) (see Clipit in Express Tools help). | ;;; | ;;;*************************************************************************************************| ;;; ClipIt creates a pseudo circle of polylines, the connector line will most likely have a gap. | ;;; | ;;; Optionally you could comment the part erasing it. | ;;; | ;;;*************************************************************************************************| ;;; (defun c:MSCIRCLIP (/ ent cen rad circle newPt scaleFactor newRad vec dir pt1 pt2 len scaledBlock detailCircle entsBefore entsAfter diffBlocks ) (vl-load-com) (prompt "\n--- MODELSPACE DETAIL VIEW WITH CLIPIT ---\n") ;; Modelspace entities (defun all-ents () (vl-remove-if 'null (mapcar 'cadr (ssnamex (ssget "_X" '((410 . "Model"))))) ) ) ;; Select block reference (setq ent (car (entsel "\nSelect block reference to detail: "))) (if (not (and ent (= (cdr (assoc 0 (entget ent))) "INSERT"))) (progn (prompt "\nNot a valid block reference.") (exit)) ) ;; Circle center/radius (setq cen (getpoint "\nSpecify center of detail circle: ")) (setq rad (getdist cen "\nSpecify radius of detail circle: ")) (entmakex (list '(0 . "CIRCLE") (cons 10 cen) (cons 40 rad) (cons 62 1) (cons 8 "DETAIL") ) ) ;; Detail location and scale (setq newPt (getpoint "\nSpecify center point for detail view: ")) (initget 7) (setq scaleFactor (getreal "\nEnter detail scale factor (e.g. 2): ")) (setq newRad (* rad scaleFactor)) ;; Copy and scale block (command "COPY" ent "" cen newPt) (setq scaledBlock (entlast)) (command "SCALE" scaledBlock "" newPt scaleFactor) ;; Clipping circle (setq detailCircle (entmakex (list '(0 . "CIRCLE") (cons 10 newPt) (cons 40 newRad) (cons 62 1) (cons 8 "DETAIL") ) ) ) ;; Run CLIPIT manually (prompt "\n>>> Run CLIPIT: Select the detail circle and the new (scaled) block.\n" ) (C:CLIPIT) ;; Delete temp circle after CLIPIT (if (and detailCircle (entget detailCircle)) (entdel detailCircle) ) ;; Draw connector line (setq vec (mapcar '- newPt cen)) (setq len (distance cen newPt)) (setq dir (mapcar '/ vec (list len len len))) (setq pt1 (mapcar '+ cen (mapcar '* dir (list rad rad rad)))) (setq pt2 (mapcar '- newPt (mapcar '* dir (list newRad newRad newRad)) ) ) (entmakex (list '(0 . "LINE") (cons 10 pt1) (cons 11 pt2) (cons 62 3) (cons 8 "DETAIL") ) ) (prompt "\nDetail view created and connector drawn.\n") (princ) ) very good, I have to say that it almost works, once I have to select the circle it doesn't give me the detail. anyway thanks Quote
SLW210 Posted Tuesday at 03:46 PM Posted Tuesday at 03:46 PM You need to read the instructions. Select the CIRCLE, then Select the BLOCK, then input the max allowable error distance value (I used 1). At the prompt-Select the detail circle then select the copied and scaled block. At Enter maximum allowable error distance for resolution of arc segments. I used 1 and it seems good (smaller is more segments) (see Clipit in Express Tools help). Post one of your blocks, it works on some blocks I created to test. Quote
jim78b Posted Wednesday at 05:35 AM Author Posted Wednesday at 05:35 AM 13 hours ago, SLW210 said: You need to read the instructions. Select the CIRCLE, then Select the BLOCK, then input the max allowable error distance value (I used 1). At the prompt-Select the detail circle then select the copied and scaled block. At Enter maximum allowable error distance for resolution of arc segments. I used 1 and it seems good (smaller is more segments) (see Clipit in Express Tools help). Post one of your blocks, it works on some blocks I created to test. I tried your code and i did as It request. But no circle block detail Is created.sorry today i try again . Quote
jim78b Posted Wednesday at 06:46 AM Author Posted Wednesday at 06:46 AM (edited) 15 hours ago, SLW210 said: You need to read the instructions. Select the CIRCLE, then Select the BLOCK, then input the max allowable error distance value (I used 1). At the prompt-Select the detail circle then select the copied and scaled block. At Enter maximum allowable error distance for resolution of arc segments. I used 1 and it seems good (smaller is more segments) (see Clipit in Express Tools help). Post one of your blocks, it works on some blocks I created to test. ok thanks i tested and worked! only one question...it don't work on nested blocks? Edited Wednesday at 06:49 AM by jim78b Quote
SLW210 Posted Wednesday at 10:25 AM Posted Wednesday at 10:25 AM You mentioned nothing about nested blocks. It worked on your example drawing and mine. I forgot you want 2 tangent lines, I only use a single, maybe I can modify that as an option. I'll look into nested blocks, but I don't think that's going to be easy. Maybe replacing ClipIt with Cookiecutter. 1 Quote
jim78b Posted Wednesday at 01:34 PM Author Posted Wednesday at 01:34 PM 3 hours ago, SLW210 said: You mentioned nothing about nested blocks. It worked on your example drawing and mine. I forgot you want 2 tangent lines, I only use a single, maybe I can modify that as an option. I'll look into nested blocks, but I don't think that's going to be easy. Maybe replacing ClipIt with Cookiecutter. oh sorry, however great works thanks Quote
CyberAngel Posted Wednesday at 01:50 PM Posted Wednesday at 01:50 PM On 6/22/2025 at 7:56 AM, SLW210 said: Easy enough to solve. The easiest way is to just use a viewport in a layout, but you can lead a horse to water... I faced a similar situation and used viewports. Supervisor wouldn't have it. As usual, he made everything three times as hard, then complained that it was taking too long. Also it wasn't pretty enough. Quote
jim78b Posted Wednesday at 02:35 PM Author Posted Wednesday at 02:35 PM 44 minutes ago, CyberAngel said: I faced a similar situation and used viewports. Supervisor wouldn't have it. As usual, he made everything three times as hard, then complained that it was taking too long. Also it wasn't pretty enough. don't worry Quote
Recommended Posts
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.