+ Reply to Thread
Page 1 of 5 1 2 3 ... LastLast
Results 1 to 10 of 50
  1. #1
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Jun 2009
    Posts
    3

    Default getting 3dSolid Box properties using VBA...

    Registered forum members do not see this ad.

    Hello!
    The problem is:
    When i create a Box, then select it and click right mouse button and select properties menu, the window called Propertoes is displayed. This window have information about the box that is selected such as Length, heigh, width and so on...
    So i need to write VB application where i can store this parameters. I need to do this only with Box objects that are free oriented in a ModelSpace.
    Thank you for your advices!

  2. #2
    Super Member SEANT's Avatar
    Using
    AutoCAD 2012
    Join Date
    Aug 2005
    Location
    Rhode Island
    Posts
    1,968

    Default

    Are you saying you need to store the information at time of the box’s creation?

    If so then using BeginCommand and/or EndCommand event handler would probably be effective. The normal user interface for a solids creation could be replaced by a custom version that records the pertinent data.

    -OR-

    Are you trying to retrieve the dimensions of solids already in a drawing? If the solids are indeed simple boxes box then 3DSolid.PrincipalDirections can be used in conjunction with a .TransformedBy and a .GetBoundingBox to retrieve the box dimensions.

  3. #3
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Jun 2009
    Posts
    3

    Default

    Thank you for reply!
    I am trying to retrieve the dimensions of solids that are already in a drawing.

    As i understood, your method is...
    1. Get 3DSolid.PrincipalDirections to find the orientation of the box in a modelSpace
    2. Then 3DSolid.TransformedBy ( and here should be PrincipalDirections that we have found in 1 step)
    3. And finaly .GetBoundingBox.
    That is the way of solving my problem, but i dont like it. I want to know if there is is a way to get properties of the box right from the properties window that you can view in attachment file.
    Attached Images

  4. #4
    Super Member SEANT's Avatar
    Using
    AutoCAD 2012
    Join Date
    Aug 2005
    Location
    Rhode Island
    Posts
    1,968

    Default

    Quote Originally Posted by 99garry View Post
    I want to know if there is is a way to get properties of the box right from the properties window that you can view in attachment file.
    It is certainly logical to think that possible but, oddly enough, it is not (at least not for solids with arbitrary orientations in space). Autodesk did not include a full compliment of properties or methods for the 3DSolid object.

    In the case of dealing with regular box solids the process I described, though cumbersome, wouldn’t be too taxing for the coder during design, nor the machine at runtime. If the solid is not so regular, i.e., has undergone Boolean operations, the task becomes considerably more complex.

    I’ve got a VBA sample if you’re interested.
    Last edited by SEANT; 27th Jun 2009 at 09:25 am. Reason: typo

  5. #5
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Jun 2009
    Posts
    3

    Default

    Quote Originally Posted by SEANT View Post
    It is certainly logical to think that possible but, oddly enough, it is not (at least not for solids with arbitrary orientations in space). Autodesk did not include a full compliment of properties or methods for the 3DSolid object.

    In the case of dealing with regular box solids the process I described, though cumbersome, wouldn’t be too taxing for the coder during design, nor the machine at runtime. If the solid is not so regular, i.e., has undergone Boolean operations, the task becomes considerably more complex.

    I’ve got a VBA sample if you’re interested.
    Yes please poste the VBA sample here, or send me email

    Autodesk did not include a full compliment of properties or methods for the 3DSolid object. ---------- This is very strange. Because methods and properties like:

    MomentOfInertia

    PrincipalMoments

    ProductOfInertia

    RadiiOfGyration

    Volume

    -- at least requires object length heigh and width for a BOX objects.

    I am trying to say that length heigh and width properties are more important than those i have mentioned before.

  6. #6
    Super Member SEANT's Avatar
    Using
    AutoCAD 2012
    Join Date
    Aug 2005
    Location
    Rhode Island
    Posts
    1,968

    Default

    The more cynical explanation would be that the 3DSolid portion of the API was purposely hamstrung to obstruct customization efforts competing directly with Autodesk Inventor.

    Be that as it may, a lot of things are possible, just with a bit more effort from the coder. I’ll put together that sample and post it shortly.

  7. #7
    Super Member SEANT's Avatar
    Using
    AutoCAD 2012
    Join Date
    Aug 2005
    Location
    Rhode Island
    Posts
    1,968

    Default

    Here is a sample.
    Attached Files

  8. #8
    Forum Newbie
    Using
    AutoCAD 2008
    Join Date
    Dec 2009
    Posts
    2

    Default little problem with some boxes

    Hello SEANT,
    thank you for your code, y use it, but there is a problem with boxes who have two same dimensions (example : Long 1000 ; larg 200 ; height 200).
    In this example, the dimensions are calculate too long.

    Have you a solution/correction for this little problem ?

    Sorry for my bad english, y am french..

    Patick.

  9. #9
    Super Member SEANT's Avatar
    Using
    AutoCAD 2012
    Join Date
    Aug 2005
    Location
    Rhode Island
    Posts
    1,968

    Default

    Interesting. There is a discrepancy in how AutoCAD generates a solid’s Principal Directions. That discrepancy causes my routine to fail on a solid with matching dimensions unless the sides are aligned to X, Y, or Z.

    Give me a bit of time and I’ll fix it.

  10. #10
    Super Member SEANT's Avatar
    Using
    AutoCAD 2012
    Join Date
    Aug 2005
    Location
    Rhode Island
    Posts
    1,968

    Default

    Registered forum members do not see this ad.

    Here is an updated version that should return the correct dimensions regardless of how length, width, and depth relate to each other.
    Attached Files

Similar Threads

  1. How to read 3DSolid in DXF files
    By josefo in forum AutoCAD 3D Modelling & Rendering
    Replies: 7
    Last Post: 25th Sep 2012, 10:04 am
  2. 3dsolid imprint
    By Geoffers in forum AutoCAD 3D Modelling & Rendering
    Replies: 6
    Last Post: 11th Sep 2009, 12:15 pm
  3. ADT Won't Open Due To 3DSOLID...
    By sammykz in forum Autodesk Software General
    Replies: 5
    Last Post: 18th Dec 2008, 01:17 am
  4. 3Dsolid revolve
    By stary7 in forum AutoLISP, Visual LISP & DCL
    Replies: 2
    Last Post: 23rd Sep 2006, 07:59 pm
  5. Viewing 3DSolid vertex
    By LeoRoncetti in forum AutoLISP, Visual LISP & DCL
    Replies: 3
    Last Post: 2nd May 2006, 01:14 am

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