+ Reply to Thread
Page 1 of 2 1 2 LastLast
Results 1 to 10 of 11
  1. #1
    Junior Member
    Computer Details
    andy81's Computer Details
    Operating System:
    XP , Win7
    Discipline
    Structural
    andy81's Discipline Details
    Occupation
    CAD Support
    Discipline
    Structural
    Using
    AutoCAD 2011
    Join Date
    Sep 2013
    Location
    Canada
    Posts
    10

    Default Can I Use AutoLISP to get volume of a Complex 3D Primitive Shape?

    Registered forum members do not see this ad.

    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.

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

  2. #2
    Senior Member ymg3's Avatar
    Using
    not applicable
    Join Date
    May 2011
    Posts
    414

    Default

    Andy,

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

  3. #3
    Junior Member
    Computer Details
    andy81's Computer Details
    Operating System:
    XP , Win7
    Discipline
    Structural
    andy81's Discipline Details
    Occupation
    CAD Support
    Discipline
    Structural
    Using
    AutoCAD 2011
    Join Date
    Sep 2013
    Location
    Canada
    Posts
    10

    Default

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

  4. #4
    Senior Member ymg3's Avatar
    Using
    not applicable
    Join Date
    May 2011
    Posts
    414

    Default

    Andy,

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

    What is GetWeight in the methods?

    ymg

  5. #5
    Junior Member
    Computer Details
    andy81's Computer Details
    Operating System:
    XP , Win7
    Discipline
    Structural
    andy81's Discipline Details
    Occupation
    CAD Support
    Discipline
    Structural
    Using
    AutoCAD 2011
    Join Date
    Sep 2013
    Location
    Canada
    Posts
    10

    Default

    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

    I'm not discouraged though, i'm having fun.
    Thanks for your help!
    cheers,
    Andy

  6. #6
    Senior Member ymg3's Avatar
    Using
    not applicable
    Join Date
    May 2011
    Posts
    414

    Default

    Andy,

    Code:
    vlax-invoke-method
    Trouble with this is you need to find out what argument you need, probably the object only.

    ymg

  7. #7
    Luminous Being
    Using
    Civil 3D 2016
    Join Date
    Dec 2005
    Location
    GEELONG AUSTRALIA
    Posts
    9,721

    Default

    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.
    A man who never made mistakes never made anything

  8. #8
    Forum Newbie
    Using
    AutoCAD 2014
    Join Date
    Dec 2015
    Posts
    1

    Default

    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 ?

  9. #9
    Forum Newbie
    Using
    AutoCAD 2014
    Join Date
    Sep 2016
    Posts
    1

    Default Automatic 3d volume table

    Quote Originally Posted by ymg3 View Post
    Andy,

    Code:
    (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?

  10. #10
    Super Member marko_ribar's Avatar
    Computer Details
    marko_ribar's Computer Details
    Operating System:
    Windows 7 Ultimate X64
    Computer:
    Intel quad core CPU 4x2.66GHz, 8GB RAM
    Motherboard:
    INTEL compatibile
    CPU:
    quad core 4x2.66GHz
    RAM:
    8GB
    Graphics:
    NVIDIA GeForce 6600 GT
    Primary Storage:
    250 GB
    Secondary Storage:
    500 GB
    Monitor:
    Samsung 17''
    Discipline
    Architectural
    marko_ribar's Discipline Details
    Occupation
    Architecture, project designer, project visualisation
    Discipline
    Architectural
    Details
    space design - modeling and animations
    Using
    AutoCAD 2014
    Join Date
    Feb 2010
    Location
    Belgrade, Serbia, Europe
    Posts
    1,213

    Default

    Registered forum members do not see this ad.

    Quote Originally Posted by Chris9 View Post
    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?t...3556#msg563556

    HTH, M.R.

    Marko Ribar, d.i.a. (graduated engineer of architecture)
    M.R. on YouTube

Similar Threads

  1. creating a complex linetype with shape
    By arman88 in forum AutoCAD 2D Drafting, Object Properties & Interface
    Replies: 17
    Last Post: 17th Dec 2013, 12:52 pm
  2. how do i get the volume of this shape?
    By lewysr in forum AutoCAD 3D Modelling & Rendering
    Replies: 5
    Last Post: 26th Sep 2010, 04:20 am
  3. Creating a complex shape to extrude?
    By bbudding in forum AutoCAD 3D Modelling & Rendering
    Replies: 9
    Last Post: 6th Nov 2009, 09:36 am
  4. Complex Shape Design (AOTC)
    By Lazer in forum Autodesk Inventor
    Replies: 1
    Last Post: 16th Nov 2007, 09:06 pm
  5. Volume of a complex solid
    By dyollnave in forum AutoCAD 3D Modelling & Rendering
    Replies: 3
    Last Post: 10th Aug 2007, 06:46 pm

Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts