entmake a 3D surface (donut) feature

entmake a 3D surface (donut) feature

bob_basques
Enthusiast Enthusiast
2,123 Views
13 Replies
Message 1 of 14

entmake a 3D surface (donut) feature

bob_basques
Enthusiast
Enthusiast

All,

 

So, I created a Surface feature that is a large circle with a smaller circle subtracted from the larger.  A "donut" feature.  I want to use this to extrude a pipe along a 3D polyline to generate a real CAD pipe with a defined thickness, but I need to be able to build this donut via entmake (much faster).

 

I have the Donut feature and I run:

 

Command: (entget (car (entsel)))

 

and it returns this gobble-di-goop, anyone know what language this is:

 

Select object: ((-1 . <Entity name: 23f296c8810>) (0 . "PLANESURFACE") (330 . <Entity name: 23f1f6311f0>) (5 . "87B1") (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbModelerGeometry") (70 . 1) (1 . "mmloo mm m k ") (1 . "ni ^*+0;:,4 ^*+0\\^[ mo ^LR mmjqjqoqijjlj QK o ") (1 . "mjqlfffffffffffffgjg fqfffffffffffffffjkh:roh nqooooooooooooooooli:rno ") (1 . ">,27:>;:- {rn rn _nl mmjqjqoqijjlj |") (1 . "=0;& {rn rn {rn {m {rn {l |") (1 . "3*2/ {rn rn {rn {rn {k {n |") (3 . "+->1,90-2 {rn rn n rkqflolgoijhilnlmlhgk:rlm kqkkogfmofgjooiminim:rni rkqkkogfmofgjooiminim:rni rnqglifhonfghmnomfnfk:rni n lqmmhkojhglojoonfgnm:rlm rn rnqglifhonfghmnomfnfk:rni rmlghqnmkmiijooiohoik nqlhhhifljkljghinlni:rnm rhjooqmmhollnhihfkfhi n -0+>+:") (1 . " 10@-:93:<+ 10@,7:>- |") (1 . ",7:33 {rn rn {rn {rn {rn {j {rn {m |") (1 . "9><: {i rn {rn {rn {h {k {rn {g 90-(>-; ;0*=3: 0*+ |") (1 . "/:-,*=:1+r><>;L036;W6,+0-&r>++-6= {rn rn {rn {rn {j n m nooooooooo noon |") (1 . "300/ {rn rn {rn {f {no {j |") (1 . "/3>1:r,*-9><: {rn rn {rn mlghqnmkmiijooinomkh hjoiqmmhollnhihfkoii o o o n n o o 90-(>-;@) V V V V |") (1 . "300/ {rn rn {rn {rn {nn {j |") (1 . "<0:;8: {rn rn {rn {no {no {rn {nm 90-(>-; {h o {rn |") (1 . "<0:;8: {rn rn {rn {nn {nn {rn {nl 90-(>-; {f o {rn |") (1 . ":;8: {nk rn {rn {nj rlqnknjfmijljgfhflnni {nj lqnknjfmijljgfhflnni {no {ni 90-(>-; _h *1410(1 |") (1 . ":;8: {nh rn {rn {ng rlqnknjfmijljgfhflnni {ng lqnknjfmijljgfhflnni {nn {nf 90-(>-; _h *1410(1 |") (1 . "/:-,*=:1+r><>;L036;W6,+0-&r>++-6= {rn rn {rn {rn {nm n n nooooooooo jnoon |") (1 . "):-+:' {rn rn {rn {nm o {mo |") (1 . ":336/,:r<*-): {rn rn {rn mlghqnmkmiijooinomkh hjoiqmmhollnhihfkoii o ro ro rn ri ro o n V V |") (1 . "/:-,*=:1+r><>;L036;W6,+0-&r>++-6= {rn rn {rn {rn {nl n m nooooooooo jnoon |") (1 . "):-+:' {rn rn {rn {nl o {mn |") (1 . ":336/,:r<*-): {rn rn {rn mlghqnmkmiijooinomkh hjoiqmmhollnhihfkoii o o o n rgqhj ro o n V V |") (1 . "/061+ {rn rn {rn mlflqnmkmiijooinomkh hjoiqmmhollnhihfkoii o |") (1 . "/061+ {rn rn {rn mlfjqghkmiijooinomkh hjoiqmmhollnhihfkoii o |") (290 . 1) (2 . "{cecf3351-7f3c-6048-b1bc-aec1944323d9}") (100 . "AcDbSurface") (71 . 6) (72 . 6))

 

 

0 Likes
Accepted solutions (1)
2,124 Views
13 Replies
Replies (13)
Message 2 of 14

Kent1Cooper
Consultant
Consultant

You are probably out of luck.  Entity data for Surfaces, and also for Regions and 3D Solids, is utter inscrutable and very likely impossible to generate for use in (entmake).  I expect you'll need to make it with (command) or (vl-cmdf) functions.

Kent Cooper, AIA
0 Likes
Message 3 of 14

bob_basques
Enthusiast
Enthusiast

Hi Kent,

 

Yeah I just found a similar description in the DXF manual, a lot of use of the phrase "proprietary data".  Seems to apply to anything 3D, 3DSOLID, BODY, REGION, and SURFACE.  Just search on AcDbModelerGeometry here: 

 

https://images.autodesk.com/adsk/files/autocad_2012_pdf_dxf-reference_enu.pdf

 

I could probably build all my combinations by hand for pre assembly via LISP/ENTMAKE, but there are a few hundred different  potential pipe sizes with different wall thicknesses.  Hmm, maybe stuff the DXF code into Postgres, all the data is coming from there anyway . . .  I already have the COMMAD version started.  Paintfull though, need to draw two circles make them both into a SURFACE/REGION, then subtract the smaller from the larger.

 

I'm going to try and assemble a static pipesize/wallthickness with Entmake and see how fast it is.  If it's fast enough, I can write a routine in AutoCAD to stuff the pipe/wall thicknesses into Postgres, then pull the correct "google-di-goop" back out on demand . . . might not be worth it in the end though, I still have to extrude along the 3D polyline paths, which will likely take some time to process.

 

bobb

 

bobb

 

 

 

 

0 Likes
Message 4 of 14

ronjonp
Mentor
Mentor

Maybe something like this will help, it's not ENTMAKE but you can feed it a list of OD ID and it will spit out pipe walls 🙂

 

(defun _pipewalls (p lrg sml / a b c d sp)
  (setq c (vl-sort (list lrg sml) '>))
  (cond	((and (setq a (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 (car c)))))
	      (setq b (entmakex (list '(0 . "CIRCLE") (cons 10 p) (cons 40 (cadr c)))))
	      (setq sp (vlax-ename->vla-object (cdr (assoc 330 (entget a)))))
	 )
	 (setq c (car (vlax-invoke sp 'addregion (list (vlax-ename->vla-object a)))))
	 (setq d (car (vlax-invoke sp 'addregion (list (vlax-ename->vla-object b)))))
	 (mapcar 'entdel (list a b))
	 (vla-boolean c acsubtraction d)
	)
  )
  (princ)
)
(vl-load-com)
;; Makes 4" 8" 10" 12" pipe wall profiles
(foreach l '((4.2 4) (8 7.8) (10 9.7) (11.7 12)) (_pipewalls '(0 0 0) (car l) (cadr l)))

 

 

Message 5 of 14

Sea-Haven
Mentor
Mentor

Why not extrude along a path do twice ID OD then subtrcat ID from OD can be done as a lisp, use rotate3d to flip the circles to 90 at ends 

SeaHaven_0-1644276535122.png

 

0 Likes
Message 6 of 14

bob_basques
Enthusiast
Enthusiast

I will look at this.

 

My big deal is being able to draw everything very fast, which typically equals creating via ENTMAKE.  I can draw 30k 3D pipe invert lines in a few seconds right now with ENTMAKE, but the actual 3D CAD model building takes a few second to make 20-30 of them, just looking for more speed.

 

bobb

 

0 Likes
Message 7 of 14

bob_basques
Enthusiast
Enthusiast

I looked at this approach too. Actually Pieces of it I was going to use, just wasn't to the step of rotating the end cap perp to the 3D line yet. I thought maybe it might be slower than building the pipe section and extruding it, but maybe it takes the same amount of time to draw.

 

Either way, thanks for the help, still working through it.

0 Likes
Message 8 of 14

ronjonp
Mentor
Mentor

@bob_basques wrote:

I will look at this.

 

My big deal is being able to draw everything very fast, which typically equals creating via ENTMAKE.  I can draw 30k 3D pipe invert lines in a few seconds right now with ENTMAKE, but the actual 3D CAD model building takes a few second to make 20-30 of them, just looking for more speed.

 

bobb

 


The vl functions are pretty fast too. Let me know how it goes!

0 Likes
Message 9 of 14

Sea-Haven
Mentor
Mentor

A few seconds !! How long would it take you to make 20-30 doing each one manually.

 

The rotate3d for circle you can use UCS ob and pick start point of pline then entmake a circle and rotate3d or look into setting UCS correct on end point and standing vertical. Then extrude using path.

0 Likes
Message 10 of 14

CodeDing
Mentor
Mentor
Accepted solution

@bob_basques ,

 

Idk what your current workflow looks like, but I stole some code from @ronjonp to throw this together. Might be worth a shot?

I couldn't figure out how to make it any faster than this. Perhaps one of these smart guys can speed things up a bit from here.

(defun c:FASTPIPE ( / ss od id)
  (vl-load-com)
  (setq *modelSpace* (vla-get-ModelSpace (vla-get-ActiveDocument (vlax-get-acad-object))))
  (if (and (progn (prompt "\nSelect 3D Polylines: ") (setq ss (ssget '((0 . "POLYLINE")))))
           (progn (initget 7) (setq od (getreal "\nEnter Outer Diameter: ")))
           (progn (initget 7) (setq id (getreal "\nEnter Inner Diameter: ")))
      );and
    (repeat (setq cnt (sslength ss))
      (setq e (ssname ss (setq cnt (1- cnt))))
      (Create3DPipe e od id nil)
    );repeat
  );if
  (prompt "\nPipe Complete.")
  (princ)
);defun

(defun Create3DPipe (e od id deletePL / p1 p2 nv pt c1 c2 sp r1 r2 solid)
  ;; e - ename, of 3D Polyline
  ;; od - real, outer diameter of 'pipe'
  ;; id - real, inner diameter of 'pipe'
  ;; deletePL - boolean, will delete provided 3D Polyline (e) if true.
  ;; returns - vla-object, of 3D Solid 'pipe'
  (setq p1 (cdr (assoc 10 (entget (entnext e))))
        p2 (cdr (assoc 10 (entget (entnext (entnext e)))))
        nv (trans '(0.0 0.0 1.0) (mapcar '- p2 p1) 0 t)
        pt (trans p1 0 nv)
        c1 (entmakex (list '(0 . "CIRCLE") (cons 10 pt) (cons 40 (* 0.5 od)) (cons 210 nv)))
        c2 (entmakex (list '(0 . "CIRCLE") (cons 10 pt) (cons 40 (* 0.5 id)) (cons 210 nv)))
        sp (vlax-ename->vla-object (cdr (assoc 330 (entget c1))))
        r1 (car (vlax-invoke sp 'addregion (list (vlax-ename->vla-object c1))))
        r2 (car (vlax-invoke sp 'addregion (list (vlax-ename->vla-object c2))))
  );setq
  (entdel c1) (entdel c2)
  (vla-boolean r1 acsubtraction r2)
  (setq solid (vla-AddExtrudedSolidAlongPath *modelSpace* r1 (vlax-ename->vla-object e)))
  (vla-delete r1)
  (if deletePL (entdel e))
  solid
);defun

 

Best,

~DD

Message 11 of 14

bob_basques
Enthusiast
Enthusiast

DD,

 

This is actually working pretty good, going to test against some complicated 3Dplines, but it seems very fast so far.

 

I have a SQL query that I run for a list of all the pipes within a certain polygon, an example output from that would look like:

 

("objectid" "pacmaterial" "pacmainshape" "active" "downelev"  "upelev"  "pipeheight" "pipewidth" "material" "mainshape" "geom" "WKT") 

(118535 "VCP" "C" nil 192.16 194.68 12.0 12.0 "VCP" "C" "0105000020840D030001000000010200000002000000805E66AFD2C02141006EB5E8DAB603410023F20B9FBF214100C6A802ABB30341" "MULTILINESTRING M ((581737.34257789 161499.3636273 194.68,581583.523331732 161397.376298472 192.16))") 
(118580 "VCP" "C" nil 125.9 142.4 12.0 12.0 "VCP" "C" "0105000020840D03000100000001020000000200000080EA94BC0FC42141003AB98398700341000094A4A5C22141002E874C386C0341" "MULTILINESTRING M ((582151.868323639 159251.064318135 142.4,581970.82144165 159111.03736721 125.9))") 
(118655 "VCP" "C" nil 165.35 173.55 12.0 12.0 "VCP" "C" "0105000020840D030001000000010200000002000000000494D1D0B92141005CAE5A0AC3034180084F5AD9B9214100D293AE7FB90341" "MULTILINESTRING M ((580840.409332395 161889.294277877 173.55,580844.676384225 161583.960242882 165.35))") . . . .

 

and then iterate through the list to build the pipes along the defined 3Dpolylines (geom).  

 

Thanks so far, will report back as I move forward.

 

bobb

 

 

0 Likes
Message 12 of 14

Sea-Haven
Mentor
Mentor

I have seen autodesk Plant working and it is so fast drawing in 3d as you go, stuff like 90 bends etc 

 

I have looked at 3d stair handrails which have curves in them and it gets complicated, do you have any curves needed in your 3d pipe ?

 

have a look at this tube bending lisp or?? - AutoLISP, Visual LISP & DCL - AutoCAD Forums (cadtutor.net)

0 Likes
Message 13 of 14

Sea-Haven
Mentor
Mentor

No idea of speed but extrude circle 1 & Circle 2 then subtract no need to make regions and only 1 solid remains anyway. 

 

0 Likes
Message 14 of 14

bob_basques
Enthusiast
Enthusiast

~dd,

 

This is actually working as is.  I can use this as an INCLUDE and draw the pipes on the fly, and very fast too.   Let me figure out a way to approximate the wall thickness based on material, then I can move forward with automation.  after talking with Engineering, they are actually more worried about the inside Diameter being accurate than anything, so at this point I can estimate the wall thickness.

 

report back when I have more . . .

 

bobb

 

Thanks

0 Likes