Jump to content

BoundedVolumes Method


Trudy

Recommended Posts

Hello again.

I hope not to ban me for overwriting post. But today i found one very interesting function. And do some research how i can use it in some lisp and i found this method which i think is interesting.

After my research 5-6 hours i cannot find any information how to use it.

I take some info from Here and try everything i can. Also i try This because i think this will be more easy. 

I attach .dwg and code where is very wrong i think but...

 

(defun LM:group-n ( l n / r )
    (if l
        (cons
            (reverse (repeat n (setq r (cons (car l) r) l (cdr l)) r))
            (LM:group-n l n)
        )
    )
)

(defun gc:3dPointListToVariant (lst)
  (vlax-make-variant
    (vlax-safearray-fill
      (vlax-make-safearray
        vlax-VbDouble
        (cons 0 (1- (* 3 (length lst))))
      )
      (apply 'append lst)
    )
  )
)

(defun c:dd2 (/ selL VnamL VnamS coord inv) 
(setq selL (car (entsel "\nSelect Poly..")))
(setq VnamL (vlax-ename->vla-object selL))
(setq coord (gc:3dPointListToVariant (LM:group-n (vlax-get VnamL 'coordinates) 3)))
(setq selS (car (entsel "\nSelect volumeSurf..")))
(princ "\n")
(setq VnamS (vlax-ename->vla-object selS))


(setq inv (vl-catch-all-apply 'vlax-invoke-method (list (vlax-get VnamS 'Statistics) 'BoundedVolumes coord)))
(princ inv)
;(princ (vl-catch-all-error-message inv))
(princ)
)

 

And only to say, dont be mad at me im not a programmer this is just hobby :)
And thank for all help, where you gave me :)

Test3.dwg

Link to comment
Share on other sites

10 hours ago, Trudy said:

Hello again.

I hope not to ban me for overwriting post. But today i found one very interesting function. And do some research how i can use it in some lisp and i found this method which i think is interesting.

After my research 5-6 hours i cannot find any information how to use it.

I take some info from Here and try everything i can. Also i try This because i think this will be more easy. 

I attach .dwg and code where is very wrong i think but...

 


(defun LM:group-n ( l n / r )
    (if l
        (cons
            (reverse (repeat n (setq r (cons (car l) r) l (cdr l)) r))
            (LM:group-n l n)
        )
    )
)

(defun gc:3dPointListToVariant (lst)
  (vlax-make-variant
    (vlax-safearray-fill
      (vlax-make-safearray
        vlax-VbDouble
        (cons 0 (1- (* 3 (length lst))))
      )
      (apply 'append lst)
    )
  )
)

(defun c:dd2 (/ selL VnamL VnamS coord inv) 
(setq selL (car (entsel "\nSelect Poly..")))
(setq VnamL (vlax-ename->vla-object selL))
(setq coord (gc:3dPointListToVariant (LM:group-n (vlax-get VnamL 'coordinates) 3)))
(setq selS (car (entsel "\nSelect volumeSurf..")))
(princ "\n")
(setq VnamS (vlax-ename->vla-object selS))


(setq inv (vl-catch-all-apply 'vlax-invoke-method (list (vlax-get VnamS 'Statistics) 'BoundedVolumes coord)))
(princ inv)
;(princ (vl-catch-all-error-message inv))
(princ)
)

 

And only to say, dont be mad at me im not a programmer this is just hobby :)
And thank for all help, where you gave me :)

Test3.dwg 781.73 kB · 2 downloads

 

 

Please put the question here

https://forums.autodesk.com/t5/civil-3d-customization/bd-p/190

Link to comment
Share on other sites

Hello this is what i do.

If someone need it.

 

(defun T:endP (pline /  endpoint end start all all2); retund list ((x1 y1 0) (x2 y2 0) ... (Xn Yn 0))
;pline - Visual name on Polyline
(setq close (vlax-get pline 'Closed))
(if (equal (vlax-get pline 'ObjectName) "AcDbPolyline")
		(progn
			(setq endpoint  (vlax-get pline 'coordinates))
				(setq start (list (car endpoint) (cadr endpoint)))
				(setq end (list (cadr (reverse endpoint)) (car (reverse endpoint))))
					(if (equal start end)
						(progn
							(setq all (append (LM:group-n endpoint 2) (list start)))
							(setq all2 (mapcar '(lambda (x) (append x (list 0))) all))
						)
					(if (equal close '-1)
						(progn
							(setq all (append (LM:group-n endpoint 2) (list start)))
							(setq all2 (mapcar '(lambda (x) (append x (list 0))) all))
						)						
					)
					)
					
		)
)
all2
)

;Lisp for return bounded volume from TIN Volume surface
;Creator: Trudy
;Date:27.04.2021
(defun c:BoundedVolume (/ selL VnamL VnamS coord inv) 

(setq selL (car (entsel "\nSelect Poly..")))
(setq VnamL (vlax-ename->vla-object selL))

(setq coord (gc:3dPointListToVariant (T:endP VnamL)))
(setq selS (car (entsel "\nSelect volumeSurf..")))
(setq VnamS (vlax-ename->vla-object selS))

(setq inv (vl-catch-all-apply 'vlax-invoke-method (list (vlax-get VnamS 'Statistics) 'BoundedVolumes coord 'pCut 'pFill 'pNet)))
(princ "\n")
(princ (rtos pCut 2 3))
(princ "\n")
(princ (rtos pFill 2 3))

(princ)
)

 

Used lisp: Lee mac - http://www.lee-mac.com/groupbynum.html

                  gile - https://www.theswamp.org/index.php?topic=31674.0

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