Jump to content

Recommended Posts

Posted

Hello kind Lispers, I am wondering if someone can point me in the right direction.

I have a 3D Primitive Shape, many of them actually. Picture a concrete building floor with slopes, and drain trenches. none of the shapes are simple rectangles.

 

I see that the AutoCAD command: list will produce the following.

 

Command: list

Select objects: 1 found

Select objects:

                 Ks_VolBody  Layer: "0"
                           Space: Model space
                  Handle = 1bc
Coordinates of Object Entity Coordinate System
Origin   X=  122.2666 Y=   66.7545 Z=    0.0000
Xaxis    X=    1.0000 Y=    0.0000 Z=    0.0000
Yaxis    X=    0.0000 Y=    0.0000 Z=    1.0000
VersionIndex = 0
PartOrigin              =-1
Area              =128102.870250
Volume            =2752941.011569
Center of Weight X=276.671661 Y=186.828356 Z=50.368505

 

(Sorry i know that code wrapper is meant for..well.. code. but it looks better this way)

 

OK the point is. The volume that the list command produces is correct. I want this Volume, and I want to be able to simply prompt the user of my LISP to pick a shape and then store this volume in a variable.

 

The problem I am having is that I can not seem to find where to access this Volume.

 

Any help would be appreciated :)

 

Cheers!

Andy.

Posted

Andy,

 

(setq  en (car (entsel "\Pick a 3D Object"))
     obj (vlax-ename->vla-object en)
     vol (vlax-get-property obj 'Volume)
)

Posted

ymg3 thanks for the reply

 

I am starting to understand vla object better, I appreciate the help.

 

as to using the code you gave me. I see this works well for AutoCAD 3D solids. I was hopping it would also work with the Bentley ProStructures 3D Primitives. they appear to be very similar. unfortunately i get this in the command line:

GETVOL Pick a 3D Object; error: ActiveX Server returned the error: unknown 
name: VOLUME

 

I am trying to fill in the blanks as i go, I am now looking for a way of inspecting the object for clues as to where it may be stored.

 

Lee mac's "elist" tool gives me this information

Command: eex

Select object:

 (
   (-1 . <Entity name: 7ed0c560>)
   (0 . "Ks_VolBody")
   (330 . <Entity name: 7ed0acf8>)
   (5 . "1BC")
   (100 . "AcDbEntity")
   (67 . 0)
   (410 . "Model")
   (8 . "TRENCH-3D")
 )

 

And Hippe013 explained how to use vlax-dump-object

That returns this:

Command: dmpobj

Select Object:; IKs_ComVolBody: IKs_ComVolBody Interface
; Property values:
;   Application (RO) = #<VLA-OBJECT IAcadApplication 00d5f1d4>
;   AreaClassName (RO) = ""
;   Count = 1
;   CutPlaneCount (RO) = 0
;   Data1 = 0.0
;   Data2 = 0.0
;   Data3 = 0.0
;   Data4 = 0.0
;   Data5 = 0.0
;   DetailStyleName (RO) = ""
;   DisplayClassName (RO) = ""
;   Document (RO) = #<VLA-OBJECT IAcadDocument 02b7b128>
;   FacetCount (RO) = 0
;   FamilyClassName (RO) = ""
;   FreeDescriptionName (RO) = "Trench"
;   Handle (RO) = "1BC"
;   HasExtensionDictionary (RO) = 0
;   HasTrueId (RO) = 0
;   HoleFieldCount (RO) = 0
;   Hyperlinks (RO) = #<VLA-OBJECT IAcadHyperlinks 12f83aa4>
;   InsertPoint (RO) = (122.267 66.7545 0.0)
;   ItemNumber = "Item No"
;   Layer = "TRENCH-3D"
;   Linetype = "ByLayer"
;   LinetypeScale = 1.0
;   Lineweight = -1
;   LogicalLinkCount (RO) = 0
;   Material = "ByLayer"
;   MaterialIndex = 0
;   Name = "name"
;   Note1 = "note1"
;   Note2 = "note2"
;   ObjectID (RO) = 2127611232
;   ObjectName (RO) = "Ks_VolBody"
;   OutletCount (RO) = 0
;   OwnerID (RO) = 2127604984
;   PlotStyleName = "ByLayer"
;   PolyCutCount (RO) = 0
;   PosNumber = "Pos No"
;   ShipNumber = "Ship No"
;   SubbodyCount (RO) = 0
;   TrueColor = #<VLA-OBJECT IAcadAcCmColor 130fa350>
;   Visible = -1
;   WeightCenter (RO) = (276.672 186.828 50.3685)
;   XAxis (RO) = (1.0 0.0 0.0)
;   YAxis (RO) = (0.0 0.0 1.0)
; Methods supported:
;   ArrayPolar (3)
;   ArrayRectangular (6)
;   Copy ()
;   Delete ()
;   GetBoundingBox (2)
;   GetExtensionDictionary ()
;   GetInsertUcs (1)
;   GetMidLineUcs (1)
;   GetPoints (1)
;   GetPolygon (1)
;   GetTrueId (1)
;   GetWeight ()
;   GetXData (3)
;   Highlight (1)
;   IntersectWith (2)
;   Mirror (2)
;   Mirror3D (3)
;   Move (2)
;   RetrieveGeometry (1)
;   Rotate (2)
;   Rotate3D (3)
;   ScaleEntity (2)
;   SetPoints (1)
;   SetPolygon (1)
;   SetTrueId (1)
;   SetXData (2)TextScr
Command:
;   TransformBy (1)
;   Update ()

 

OK, sorry this is getting long, if someone can help me discover where Volume may be stored for this object I would appreciate it very much. I will keep looking into the help files, and other online resources, but at the moment I am unsure how to use the RetrieveGeometry method listed above. would that possibly hold the volume?

 

Thank you all for your time.:)

cheers!

Andy.

Posted

Andy,

 

Sure does't look like they have a volume property.

 

What is GetWeight in the methods?

 

ymg

Posted

Hi ymg3,

In ProStructures you can assign materials to objects, and these materials have specific weights. In the past i have set up formulas in excel that convert the output from the weight field back into Volume. This method is flawed due to careless designers using the tool without the correct settings toggled on, and / or confirming that the correct material is selected. If that was the angle you where thinking of approaching it from then thank you for the idea, but I would prefer (if possible) to find the Volume independent of weight.

 

question regarding the RetrieveGeometry Method listed above from vlax-dump-object

 

how do i write a LISP to use this method? every time I turn a corner i find a new pile of LISP i do not understand :oops:

 

I'm not discouraged though, i'm having fun.

Thanks for your help!

cheers,

Andy

Posted

Andy,

 

vlax-invoke-method 

 

Trouble with this is you need to find out what argument you need, probably the object only.

 

ymg

Posted

I think you may be in trouble a IKs_ComVolBody is probably a AEC object that means made by someone else but using Autocad you may not directly be able to retrieve the volume, it may be displayed by the other software working from 1st principles points etc ie the volume is not a direct property.

 

How do you display the volume now ?

 

Did something similar for tilt concrete panels a long time ago and it was possible to retrieve the list data and use it just trying to remember how. Did something like read lines pulling out the one I needed.

 

Found it used massprop wrote the answer out to a file and then read it back just keeping the volume line sorry no code but a solution not sure if it works on your object.

  • 2 years later...
Posted

Thank you so much. It's very helpful to me. I wanna extract this value to excel or text. Could you show me how to do ?

  • 8 months later...
Posted
Andy,

 

(setq  en (car (entsel "\Pick a 3D Object"))
     obj (vlax-ename->vla-object en)
     vol (vlax-get-property obj 'Volume)
)

 

 

 

Hi, was looking to set up a table in the layout that automatically updates the volume and weight of concrete shape when modified is this possible?

Posted
Hi, was looking to set up a table in the layout that automatically updates the volume and weight of concrete shape when modified is this possible?

 

I am not saying it isn't possible, but it'll be difficult task to accomplish with CAD stability... I am afraid you'll have to use REACTORS to monitor changes on your 3DSOLID... This unfortunately brings some CAD instability, but everything is possible if you have strong wish to accomplish your task and you coded good enough to be sure everything is working as desired... For a start I suggest that you look into this code (you had to have theswamp.org membership to access the page) :

https://www.theswamp.org/index.php?topic=50684.msg563556#msg563556

 

HTH, M.R.

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