Jump to content

Recommended Posts

Posted

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

orig.thumb.JPG.30e66a4bf4345f34e39a437b461ad245.JPG

 

they want it to be like this:

1265078433_whatineed.thumb.JPG.d8c474bd075e25f3dded9f4c7766e614.JPG

 

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
both.thumb.JPG.a9d92aca8b8f6087cb47f0b05311d8b3.JPG

sample.dwg

Posted

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

 

Posted (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! 🍻

 

 

2020-01-31_10-19-43.gif

Edited by ronjonp
  • Like 1
  • Thanks 1
Posted

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

Lazy.jpg.f70f7dbc7942168f6b4e3287469ef467.jpg

  • Funny 1
Posted

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

Posted
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 :)

  • 4 years later...
Posted

@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

image.thumb.png.2808de7d590fefbe9117a55bf6cdbb9c.png

Posted (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 by pkenewell
  • Agree 2
Posted

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.

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