ScoRm Posted January 31, 2020 Posted January 31, 2020 Ok, i guess I am just being lazy. but it would be very much ease my workload by a lot... my workmates pass this DWG files like this they want it to be like this: what i did there is like a buffer, manually, i put circles on ends of every lines Diameter is 2.1(supposed to be 2 only, i have to overlap it when i use region and union to trim the excess line) so after i att the circles, i also change the global width into 2.1 and then use lee mac's routine to make the width into just polyline. then region, then union, then explode (usually many times to remove the region) then join them to make them into Polylines sample.dwg Quote
rlx Posted January 31, 2020 Posted January 31, 2020 its not perfect but its a start. You also need Master Lee's outline objects (like you I'm very lazy) (defun c:t1 ( / doc ss i line) (vl-load-com)(setq doc (vla-get-ActiveDocument (vlax-get-acad-object))) (load (findfile "OutlineObjectsV1-1.lsp")) (if (not (tblsearch "layer" "tmp-outline")) (vl-catch-all-apply 'vla-add (list (vla-get-layers doc) "tmp-outline"))) (if (not (tblsearch "layer" "new-outline")) (vl-catch-all-apply 'vla-add (list (vla-get-layers doc) "new-outline"))) (if (setq ss (ssget "x" '((0 . "LWPOLYLINE")))) (progn (setvar 'clayer "tmp-outline") (repeat (setq i (sslength ss)) (setq line (ssname ss (setq i (1- i))))(boxline line)) (setvar 'clayer "new-outline") (if (setq ss (ssget "x" '((8 . "tmp-outline")))) (LM:outline ss)) ) ) ) ; (boxline (car (entsel))) (defun boxline ( %l / r sp ep x1 y1 x2 y2) (setq r 1 sp (vlax-curve-getStartPoint %l) ep (vlax-curve-getEndPoint %l)) (setq x1 (min (car sp) (car ep)) y1 (min (cadr sp) (cadr ep)) x2 (max (car sp) (car ep)) y2 (max (cadr sp) (cadr ep))) (vl-catch-all-apply 'vl-cmdf (list "pline" (list (- x1 r) (- y1 r)) (list (- x1 r) (+ y1 r)) (list (+ x2 r) (+ y2 r)) (list (+ x2 r) (- y2 r)) "c")) (vl-catch-all-apply 'vl-cmdf (list "fillet" "r" r "fillet" "p" (entlast))) ) hopefully you'll get better reactions Quote
ronjonp Posted January 31, 2020 Posted January 31, 2020 (edited) Here's my offering based on the example drawing: (defun c:foo (/ i l p r s sp) ;; RJP » 2020-01-31 (setq i 1.05) (setq l "BubbleLicious") (cond ((setq s (ssget '((0 . "*POLYLINE,LINE")))) (foreach e (vl-remove-if 'listp (mapcar 'cadr (ssnamex s))) (setq p (vl-sort (list (vlax-curve-getstartpoint e) (vlax-curve-getendpoint e)) '(lambda (r j) (< (car r) (car j))) ) ) (setq r (cons (entmakex (list '(0 . "LWPOLYLINE") '(100 . "AcDbEntity") '(67 . 0) (cons 8 l) '(100 . "AcDbPolyline") '(90 . 4) '(70 . 129) '(43 . 0.) '(38 . 0.) '(39 . 0.) (cons 10 (mapcar '+ (car p) (list 0 i 0))) '(42 . 1.) (cons 10 (mapcar '- (car p) (list 0 i 0))) (cons 10 (mapcar '- (cadr p) (list 0 i 0))) '(42 . 1.) (cons 10 (mapcar '+ (cadr p) (list 0 i 0))) ) ) r ) ) ) (setq sp (vlax-ename->vla-object (cdr (assoc 330 (entget (car r)))))) (setq s (vlax-invoke sp 'addregion (mapcar 'vlax-ename->vla-object r))) (mapcar 'entdel r) (setq r (ssadd)) (foreach x s (vla-put-layer x l) (ssadd (vlax-vla-object->ename x) r)) (setvar 'cmdecho 0) (command "_.union" r "") (setvar 'cmdecho 1) ) ) (princ) ) What are you going to do with all your free time now! Edited January 31, 2020 by ronjonp 1 1 Quote
rlx Posted January 31, 2020 Posted January 31, 2020 Have (almost) no idea how your routine works ronjonp but I do have an idea what I'm gonna do with all my free time 1 Quote
ScoRm Posted February 1, 2020 Author Posted February 1, 2020 OMG You guys are awesome! Good God! now what will i do with my free time... lol this routines you gave me is so helpful! thanks for the both of you! @rlx @ronjonp Quote
ronjonp Posted February 3, 2020 Posted February 3, 2020 On 1/31/2020 at 8:31 PM, ScoRm said: OMG You guys are awesome! Good God! now what will i do with my free time... lol this routines you gave me is so helpful! thanks for the both of you! @rlx @ronjonp Happy to help Quote
sadishpaul Posted March 20 Posted March 20 @ronjonp Your code works perfectly but only for lines , what if i have different type of objects i Wonder if it is possible to to create a output similar to " Master Lee's outline objects " but with an offset only need the out line of the multiple objects with an specified offset ? in the below image the green border is the required output sample-1.dwg regards Paul Quote
pkenewell Posted March 20 Posted March 20 (edited) @sadishpaul what you asking for is 20 times more complex. I don't think you're gonna get a freebie on this one, unless someone really wants the challenge. I suggest you get https://superboundary.com instead, and no - i do not represent this company nor have any affiliation with them. I just did a simple google search. I think the price is well worth it if you need this. Also see: Edited March 20 by pkenewell 2 Quote
BIGAL Posted March 20 Posted March 20 Agree super boundary may be the way to go. Never used it but looks good, Civ3D has shrinkwrap but a bit hit or miss. Looking at image 1 mistake a Triangle is not included. Top middle. 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.