motee-z Posted April 18, 2023 Author Posted April 18, 2023 Also autocad2024 gives wrong value for volume .comparing value volume with real volume in addition to if you move the 3d solid to another insertion point you will get different volume result any one can check and he will see the same Quote
marko_ribar Posted April 18, 2023 Posted April 18, 2023 (edited) I don't know how to overcome an issue, but I can attach *.lsp for Bounding Box I use... It can work in any UCS currently active... HTH. M.R. BBox.lsp Edited April 18, 2023 by marko_ribar Quote
motee-z Posted April 18, 2023 Author Posted April 18, 2023 (edited) same 3d solid but created in 2 method gives deferent volume any one know the reason 2wayvolume.dwg Edited April 18, 2023 by motee-z Quote
ronjonp Posted April 18, 2023 Posted April 18, 2023 Massprop reports different as well. 2wayvolume.dwg Quote
marko_ribar Posted April 19, 2023 Posted April 19, 2023 I draw circle with radius 10.0 and copied it little right not to overlap... Then I've changed view to sw iso... I've copied one circle 10.0 units above second circle, then I used loft cross sections and it created cylinder... First circle I've extruded 10.0 and also got cylinder... Finally I've used my BBox.lsp and everything was right - height on both of them was 10.0 not smaller not bigger... Only thing with lofted one is it left grip for changing loft surface generation which I left untouched... Quote
motee-z Posted April 19, 2023 Author Posted April 19, 2023 thanks marko for reply my goal is to check volume for same 3d solid created in 2 method and comape results with the calucated one in mathematic(base area* height) when using splines or 2 dpolylines thanks Quote
marko_ribar Posted April 19, 2023 Posted April 19, 2023 splines can be 2nd degree, but little tricky to (entmake) them... 2dpolylines have to have arced segments in forming circular shape... Normally with command SPLINE - CAD generates 3rd degree curve - not desired for this task... Else should be normal to realize Volume=base x height... Quote
marko_ribar Posted April 19, 2023 Posted April 19, 2023 (edited) Here is for an ellipse : (defun c:el2spl ( / ce ch dxf11 dxf40 el elspl ptst sp1 sp1cv sp1en sp1st sp2 sp2cv sp2en sp2st sp3 sp3cv sp3en sp3st sp4 sp4cv sp4en sp4st ss ) (setq ss (ssget "_+.:E:S:L" '((0 . "ELLIPSE")))) (setq el (ssname ss 0)) (vl-cmdf "_.ucs" "e" el) (setq ce (cdr (assoc 10 (entget el)))) (setq dxf11 (cdr (assoc 11 (entget el)))) (setq dxf40 (cdr (assoc 40 (entget el)))) (setq ptst (mapcar '+ ce dxf11)) (setq ptst (trans ptst 0 1)) (setq ce (trans ce 0 1)) (setq sp1st ptst) (setq sp1en (polar ce (+ (angle ptst ce) (/ PI 2.0)) (* dxf40 (distance ptst ce)))) (setq sp1cv (polar sp1st (+ (angle ptst ce) (/ PI 2.0)) (* dxf40 (distance ptst ce)))) (setq sp1 (entmakex (append '((0 . "SPLINE") (100 . "AcDbEntity") (100 . "AcDbSpline") (70 . 12) (71 . 2) (72 . 6) (73 . 3) (74 . 0) (42 . 1.0e-010) (43 . 1.0e-010) (40 . 0.0) (40 . 0.0) (40 . 0.0) (40 . 1.0) (40 . 1.0) (40 . 1.0)) (list (cons 10 (trans sp1st 1 0)) (cons 41 1.0) (cons 10 (trans sp1cv 1 0)) (cons 41 (/ (sqrt 2.0) 2.0)) (cons 10 (trans sp1en 1 0)) (cons 41 1.0) (assoc 210 (entget el))) ))) (setq sp2st sp1en) (setq sp2en (polar ce (angle ptst ce) (distance ptst ce))) (setq sp2cv (polar sp2en (+ (angle ptst ce) (/ PI 2.0)) (* dxf40 (distance ptst ce)))) (setq sp2 (entmakex (append '((0 . "SPLINE") (100 . "AcDbEntity") (100 . "AcDbSpline") (70 . 12) (71 . 2) (72 . 6) (73 . 3) (74 . 0) (42 . 1.0e-010) (43 . 1.0e-010) (40 . 0.0) (40 . 0.0) (40 . 0.0) (40 . 1.0) (40 . 1.0) (40 . 1.0)) (list (cons 10 (trans sp2st 1 0)) (cons 41 1.0) (cons 10 (trans sp2cv 1 0)) (cons 41 (/ (sqrt 2.0) 2.0)) (cons 10 (trans sp2en 1 0)) (cons 41 1.0) (assoc 210 (entget el))) ))) (setq sp3st sp2en) (setq sp3en (polar ce (- (angle ptst ce) (/ PI 2.0)) (* dxf40 (distance ptst ce)))) (setq sp3cv (polar sp3st (- (angle ptst ce) (/ PI 2.0)) (* dxf40 (distance ptst ce)))) (setq sp3 (entmakex (append '((0 . "SPLINE") (100 . "AcDbEntity") (100 . "AcDbSpline") (70 . 12) (71 . 2) (72 . 6) (73 . 3) (74 . 0) (42 . 1.0e-010) (43 . 1.0e-010) (40 . 0.0) (40 . 0.0) (40 . 0.0) (40 . 1.0) (40 . 1.0) (40 . 1.0)) (list (cons 10 (trans sp3st 1 0)) (cons 41 1.0) (cons 10 (trans sp3cv 1 0)) (cons 41 (/ (sqrt 2.0) 2.0)) (cons 10 (trans sp3en 1 0)) (cons 41 1.0) (assoc 210 (entget el))) ))) (setq sp4st sp3en) (setq sp4en sp1st) (setq sp4cv (polar sp4en (- (angle ptst ce) (/ PI 2.0)) (* dxf40 (distance ptst ce)))) (setq sp4 (entmakex (append '((0 . "SPLINE") (100 . "AcDbEntity") (100 . "AcDbSpline") (70 . 12) (71 . 2) (72 . 6) (73 . 3) (74 . 0) (42 . 1.0e-010) (43 . 1.0e-010) (40 . 0.0) (40 . 0.0) (40 . 0.0) (40 . 1.0) (40 . 1.0) (40 . 1.0)) (list (cons 10 (trans sp4st 1 0)) (cons 41 1.0) (cons 10 (trans sp4cv 1 0)) (cons 41 (/ (sqrt 2.0) 2.0)) (cons 10 (trans sp4en 1 0)) (cons 41 1.0) (assoc 210 (entget el))) ))) (initget 1 "Yes No") (setq ch (getkword "\nErase original ellipse and leave spline (Yes/No) : ")) (if (eq ch "Yes") (entdel el)) (vl-cmdf "_.ucs" "p") (princ) ) And similar for a circle : (defun c:ci2spl ( / ce ch dxf11 dxf40 el elspl ptst sp1 sp1cv sp1en sp1st sp2 sp2cv sp2en sp2st sp3 sp3cv sp3en sp3st sp4 sp4cv sp4en sp4st ss ) (setq ss (ssget "_+.:E:S:L" '((0 . "CIRCLE")))) (setq el (ssname ss 0)) (vl-cmdf "_.ucs" "e" el) (setq ce (list 0.0 0.0 0.0)) (setq dxf40 (cdr (assoc 40 (entget el)))) (setq dxf11 (mapcar '- (polar ce 0.0 dxf40) ce)) (setq ptst (mapcar '+ ce dxf11)) (setq sp1st ptst) (setq sp1en (polar ce (+ (angle ptst ce) (/ PI 2.0)) dxf40)) (setq sp1cv (polar sp1st (+ (angle ptst ce) (/ PI 2.0)) dxf40)) (setq sp1 (entmakex (append '((0 . "SPLINE") (100 . "AcDbEntity") (100 . "AcDbSpline") (70 . 12) (71 . 2) (72 . 6) (73 . 3) (74 . 0) (42 . 1.0e-010) (43 . 1.0e-010) (40 . 0.0) (40 . 0.0) (40 . 0.0) (40 . 1.0) (40 . 1.0) (40 . 1.0)) (list (cons 10 (trans sp1st 1 0)) (cons 41 1.0) (cons 10 (trans sp1cv 1 0)) (cons 41 (/ (sqrt 2.0) 2.0)) (cons 10 (trans sp1en 1 0)) (cons 41 1.0) (assoc 210 (entget el))) ))) (setq sp2st sp1en) (setq sp2en (polar ce (angle ptst ce) dxf40)) (setq sp2cv (polar sp2en (+ (angle ptst ce) (/ PI 2.0)) dxf40)) (setq sp2 (entmakex (append '((0 . "SPLINE") (100 . "AcDbEntity") (100 . "AcDbSpline") (70 . 12) (71 . 2) (72 . 6) (73 . 3) (74 . 0) (42 . 1.0e-010) (43 . 1.0e-010) (40 . 0.0) (40 . 0.0) (40 . 0.0) (40 . 1.0) (40 . 1.0) (40 . 1.0)) (list (cons 10 (trans sp2st 1 0)) (cons 41 1.0) (cons 10 (trans sp2cv 1 0)) (cons 41 (/ (sqrt 2.0) 2.0)) (cons 10 (trans sp2en 1 0)) (cons 41 1.0) (assoc 210 (entget el))) ))) (setq sp3st sp2en) (setq sp3en (polar ce (- (angle ptst ce) (/ PI 2.0)) dxf40)) (setq sp3cv (polar sp3st (- (angle ptst ce) (/ PI 2.0)) dxf40)) (setq sp3 (entmakex (append '((0 . "SPLINE") (100 . "AcDbEntity") (100 . "AcDbSpline") (70 . 12) (71 . 2) (72 . 6) (73 . 3) (74 . 0) (42 . 1.0e-010) (43 . 1.0e-010) (40 . 0.0) (40 . 0.0) (40 . 0.0) (40 . 1.0) (40 . 1.0) (40 . 1.0)) (list (cons 10 (trans sp3st 1 0)) (cons 41 1.0) (cons 10 (trans sp3cv 1 0)) (cons 41 (/ (sqrt 2.0) 2.0)) (cons 10 (trans sp3en 1 0)) (cons 41 1.0) (assoc 210 (entget el))) ))) (setq sp4st sp3en) (setq sp4en sp1st) (setq sp4cv (polar sp4en (- (angle ptst ce) (/ PI 2.0)) dxf40)) (setq sp4 (entmakex (append '((0 . "SPLINE") (100 . "AcDbEntity") (100 . "AcDbSpline") (70 . 12) (71 . 2) (72 . 6) (73 . 3) (74 . 0) (42 . 1.0e-010) (43 . 1.0e-010) (40 . 0.0) (40 . 0.0) (40 . 0.0) (40 . 1.0) (40 . 1.0) (40 . 1.0)) (list (cons 10 (trans sp4st 1 0)) (cons 41 1.0) (cons 10 (trans sp4cv 1 0)) (cons 41 (/ (sqrt 2.0) 2.0)) (cons 10 (trans sp4en 1 0)) (cons 41 1.0) (assoc 210 (entget el))) ))) (initget 1 "Yes No") (setq ch (getkword "\nErase original circle and leave spline (Yes/No) : ")) (if (eq ch "Yes") (entdel el)) (vl-cmdf "_.ucs" "p") (princ) ) HTH. M.R. Edited April 19, 2023 by marko_ribar 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.