Is there a way to get geometric data from 3D solids??

Discussion in 'AutoCAD' started by ken666, Apr 6, 2005.

  1. ken666

    ken666 Guest

    Is there a way to get geometric data from 3D solids??

    I know that there are mass properties, but they are not really usefull. It's impossible to find out what kind of primitive(sphere, box, ...) the solid is.

    I just want to retrieve regular properties from a box, like height, width, ...

    There's a getBoundingBox method, but when you rotate the solid, this method becomes useless.

    tanks in advance
     
    ken666, Apr 6, 2005
    #1
  2. ken666

    Joe Sutphin Guest

    I do not believe this will be possible using VBA.

    Joe
     
    Joe Sutphin, Apr 6, 2005
    #2
  3. ken666

    antmjr Guest

    to manage whatever solid, you must be able to read (that’s easy) and work out his ACIS codes; I think is really difficult, not to say impossible, with VBA and a scientific knowledge like mine. A simpler task is to draw a solid from scratch (VBA creates 3Dprimitives in the WCS origin), then to move/rotate it by using .TransformBy and a transformation matrix. You may want to store this matrix (or simply the X Y and Z vectors) in the solid as extended data for further use. Of course if you rotate or mirror that solid without updating his stored matrix, the whole strategy goes to hell. One could define an object level event for that solid, so that if it will be moved, an event will update his matrix, but I for one have always had bad experiences with events. Maybe it’s easier to prevent from moving that solid with normal commands such as ‘rotate’ 'mirror' and so on, and to build your own commands instead. Or if you are lazy and you are working for yourself alone, as my case is, simply remember what you haven’t to do

    If your solid is always a true parallelepiped, with all the opposite faces parallel each other, the .PrincipalDirections gives you a possible X vector. If your box has always two vertical faces (i.e. it always lies on a vertical plan) you can easily find his transformation matrix (crossproduct of PrincipalDirections by WCS_Zvector gives you the Y vector; then Y vector by .PrincipalDirections will give you the Z vector). Unfortunately if you have to modify the box, as it happens with, say, rafters or beams, which are often sliced or moulded at the ends, the .PrincipalDirections may deviate from the axis of the beam, and isn’t usable for this task

    To measure this solid with BoundingBox, translate a copy of it to the origin and rotate it so that it lies in the right position; you need the transposed matrix of the matrix you may have stored in the solid. Otherwise you have to pick 3 meaningful points on the solid (for instance 2 points on a longitudinal edge and a third point to define the plan on which the solid lies) and calculate the matrix and the transposed matrix from them.

    Copy and .TransformBy transposed_matrix; then GetBoundingBox and .Delete
     
    antmjr, Apr 6, 2005
    #3
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.