BoundedVolumes Method

BoundedVolumes Method

Anonymous
Not applicable
1,040 Views
4 Replies
Message 1 of 5

BoundedVolumes Method

Anonymous
Not applicable

Hello.

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

 

Other used links:

This and This 

 

(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)
)
0 Likes
1,041 Views
4 Replies
Replies (4)
Message 2 of 5

hosneyalaa
Advisor
Advisor

hi

I ran it but it doesn't work

When determining what I methods and properties I can use with a vla-object I use the following.

Not everything that is IAecc is exposed to the visual lisp environment. 

;;https://forums.autodesk.com/t5/civil-3d-customization/get-point3d-values-in-property-set/m-p/9436843...

(defun c:dmpobj ( / obj)
  (setq obj (vlax-ename->vla-object (car (entsel))))
  (vlax-dump-object obj T)
  (textpage)
  (vlax-release-object obj)
  )

 

 

; IAeccTinSurface: IAeccTinSurface interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAeccApplication 000000005e941950>
;   Boundaries (RO) = #<VLA-OBJECT IAeccSurfaceBoundaries 000000005e7fa008>
;   Breaklines (RO) = #<VLA-OBJECT IAeccSurfaceBreaklines 000000005e7fb088>
;   ContourLabelGroups (RO) = #<VLA-OBJECT IAeccSurfaceContourLabelGroups 000000005e92b050>
;   Contours (RO) = #<VLA-OBJECT IAeccSurfaceContours 000000005e7fea08>
;   DefinitionProperties (RO) = #<VLA-OBJECT IAeccTinSurfaceDefinitionProperties 000000005e946bd0>
;   DEMFiles (RO) = #<VLA-OBJECT IAeccSurfaceDEMFiles 000000005e7fd008>
;   Description = ""
;   DisplayName (RO) = "ALAAC - (1)"
;   Document (RO) = #<VLA-OBJECT IAeccDocument 000000005e94b550>
;   EntityTransparency = "ByLayer"
;   Handle (RO) = "6B4F"
;   HasExtensionDictionary (RO) = -1
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 000000005e8d3838>
;   Labels (RO) = #<VLA-OBJECT IAeccSurfaceLabels 000000005e923210>
;   Layer = "C-TOPO"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   Material = "ByLayer"
;   Name = "ALAAC - (1)"
;   ObjectID (RO) = 42
;   ObjectName (RO) = "AeccDbSurfaceTin"
;   OutputTriangles (RO) = (1804.11 3669.79 1.99395 1808.67 3650.32 1.99395 ... )
;   OwnerID (RO) = 43
;   PlotStyleName = "ByLayer"
;   PointFiles (RO) = #<VLA-OBJECT IAeccSurfacePointFiles 000000005e7fbf08>
;   PointGroups (RO) = #<VLA-OBJECT IAeccSurfacePointGroups 000000005e7fb288>
;   Points (RO) = (1816.44 3652.14 2.22045e-16 1808.67 3650.32 1.99395 ... )
;   ShowToolTip = -1
;   Statistics (RO) = #<VLA-OBJECT IAeccTinSurfaceStatistics 000000005e946690>
;   Style = #<VLA-OBJECT IAeccSurfaceStyle 000000005e8787f0>
;   StyleName (RO) = "Contours 2m and 10m (Design)"
;   SurfaceAnalysis (RO) = #<VLA-OBJECT IAeccSurfaceAnalysis 000000005e947710>
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 000000005e8d3650>
;   Type (RO) = 2
;   Visible = -1
; Methods supported:
;   AddPointMultiple (1)
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   CreateSnapshot ()
;   Delete ()
;   ExtractBorder (1)
;   ExtractContour (4)
;   FindElevationAtXY (2)
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetXData (3)
;   Highlight (1)
;   IntersectPointWithSurface (2)
;   IntersectWith (2)
;   IsReferenceObject ()
;   IsReferenceStale ()
;   IsReferenceSubObject ()
;   IsReferenceValid ()
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   PasteSurface (1)
;   Rebuild ()
;   RebuildSnapshot ()
;   RemoveSnapshot ()
;   Rotate (2)
;   Rotate3D (3)
;   SampleElevations (4)
;   ScaleEntity (2)
;   SetXData (2)
;   TransformBy (1)
;   Update ()

T 
_$ 

 

 

qqq.JPG

 

 

 

0 Likes
Message 3 of 5

hosneyalaa
Advisor
Advisor

As an idea
You can add an surface boundary to it

And you inquire about volume

http://docs.autodesk.com/CIV3D/2012/ENU/API_Reference_Guide/com/AeccXLandLib__IAeccSurfaceBoundaries.htm

wwww.JPG

0 Likes
Message 4 of 5

Anonymous
Not applicable

Hello i make it work. These days i will upload the code.

Its nothing special but if someone else need it. 🙂 

 

Thank you for replay 🙂

Message 5 of 5

Anonymous
Not applicable

Hello, here is what i do.

 

(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
)

(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)
)

 

Command: BoundedVolume

Used links:

This and This 

0 Likes