Jump to content

3dSolid function


jan_ek

Recommended Posts

It is possible, but it needs lots of coding... When _B1 is created I suggest that you put XDATA of each layer widths to _B1, so that when you later do _B2 it creates exactly the same layers obtained from _B1... When subtracting to get hole, you need exploding of _B1, exploding of _B2, subtracting each layer and finally redefining _B1... So it could be done, but you need to code it (if you need it)... BTW. I work with normal 3dsolids as layers - never had a need for creating blocks... So manually subtracting each layer is way more usable than some other methods like described... Beside that, you only need to provide larger layer widths of parts you are subtracting with, so even no need for XDATA - you remember those numbers 100,200,300 - there can't be millions of them...

Link to comment
Share on other sites

Why would you not just create the solid and put hole in as part of creating solid and do 3 times then make block of the 3 objects using lisp ? Is there a reason why you do it in two steps ? Just use the elev function to stack the solids during creation. If multiples of these 3 solids are different sizes then look at dynamic block much quicker.

 

Ask a b c
length height
e d
length height
make 3 solids save block1
subtract plug
make plug 3 solids save block2

This needs repeat function etc for 2x3 solids just a start. Very rough shoudl use defuns then can stack as many or as few etc. Caution creates 2 blocks so may need a insert to see result.

(defun c:test ( / pt1 pt2 pt3 l h e d l1 h2 ent1 ent2 ent3 ent21 ent22 ent23)
(setq a 100 b 120 c 200)
(setq pt1 (getpoint "point"))
(setq L (getdist pt1 "length"))
(setq h (getdist pt1 "Height"))
(setq e (getdist pt1 "Offset e"))
(setq d (getdist pt1 "Offset d"))
(setq L2 (getreal "Length 2"))
(setq h2 (getreal "Height 2"))

(command "rectang" pt1 (list (+ (car pt1) L) (+ (cadr pt1 ) h)))
(command "zoom" "e")
(command "extrude" "l" "" a)
(setq ent1 (entlast))

(setq pt2 (list (+ (car pt1) e) (+ (cadr pt1 )d) ))
(setq pt3 (list (+ (car pt2) l2) (+ (cadr pt2 ) h2) ))
(command "rectang" pt2 pt3)
(command "extrude" "l" "" a)
(setq ent12 (entlast))
(command "subtract" ent1 "" ent12 "")

; 2nd layer

(setq pt1 (list (car pt1)(cadr pt1) a))
(command "rectang" pt1 (list (+ (car pt1) L) (+ (cadr pt1) h) a))
(command "extrude" "l" "" b)
(setq ent2 (entlast))
(setq pt2 (list (+ (car pt1) e) (+ (cadr pt1 )d) a))
(setq pt3 (list (+ (car pt2) l2) (+ (cadr pt2 ) h2) a))
(command "rectang" pt2 pt3)
(command "extrude" "l" "" b)
(setq ent22 (entlast))
(command "subtract" ent2 "" ent22 "")

; 3rd layer

(setq pt1 (list (car pt1)(cadr pt1) (+ a b)))
(command "rectang" pt1 (list (+ (car pt1) L) (+ (cadr pt1) h) (+ a b)))
(command "extrude" "l" "" c)
(setq ent3 (entlast))
(setq pt2 (list (+ (car pt1) e) (+ (cadr pt1 )d) (+ a b)))
(setq pt3 (list (+ (car pt2) l2) (+ (cadr pt2 ) h2) (+ a b)))
(command "rectang" pt2 pt3)
(command "extrude" "l" "" c)
(setq ent32(entlast))
(command "subtract" ent3 "" ent32 "")

; block part

(command "-block" "BIGAL"  (list (car pt1)(cadr pt1) 0.0) ent1 ent2 ent3 "")


; now create plugs
; like above 3 times
; put pt1 back to z=0
(setq pt1 (list (car pt1)(cadr pt1) 0.0))
(setq pt2 (list (+ (car pt1) e) (+ (cadr pt1 )d) ))
(setq pt3 (list (+ (car pt2) l2) (+ (cadr pt2 ) h2)))
(command "rectang" pt2 pt3)
(command "extrude" "l" "" a)
(setq ent21 (entlast))
(setq pt2 (list (+ (car pt1) e) (+ (cadr pt1 )d) a))
(setq pt3 (list (+ (car pt2) l2) (+ (cadr pt2 ) h2) a))
(command "rectang" pt2 pt3)
(command "extrude" "l" "" b)
(setq ent22 (entlast))
(setq pt2 (list (+ (car pt1) e) (+ (cadr pt1 )d) (+ a b)))
(setq pt3 (list (+ (car pt2) l2) (+ (cadr pt2 ) h2) (+ a b)))
(command "rectang" pt2 pt3)
(command "extrude" "l" "" c)
(setq ent23 (entlast))
(command "-block" "BIGAL2"  (list (car pt1)(cadr pt1) 0.0) ent21 ent22 ent23 "")
(command "Insert" "bigal" pt1 1 1 0)

)
(c:test)

Edited by BIGAL
Link to comment
Share on other sites

Hello, I use two step because it will not always be a cuboid.

I would like to create shape database to cutting\adding

 

Thank you for the initial code. You can eliminate the commands function ?

Link to comment
Share on other sites

I don't understand eliminate command function. Do you want it as a script ? The shape can be any you want just write a pline routine with points last is close.

Link to comment
Share on other sites

  • 2 weeks later...

Hello BIGAL

Yes, I understand that this is not a revit

But I mean exactly what you showed me.

I just want the holes to be defined in a separate file.

I would like to only be able to insert them in a revit.

Thank you for your interest in the topic

Link to comment
Share on other sites

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