Get properties of cylinder via vba

Hello,

Does anyone know how to get properties like x- and y-coordinates, hight and diameter of an 3Dcylinder with an VBA-Makro? I have a drawing with polylines, lines, 3Dcylinder and other 3D Objects and I would like the makro to search for the 3Dcylinders in the drawing and write the properties of each cylinder in a text-file.

Greetings

Comments

  • I don't know how in VBA, but Cylinders are relatively easy in languages where you can read the DXF, as you can in lisp or BRX. You may be able to in VBA, I just don't know enough about the language..

    Anyway all solids are in ACIS/SAT format. If you do a (enget(car(entsel))) on a cylinder, you will see some the standard DXF codes as well as lines like

    (1 . "shell $-1 -1 $-1 $-1 $-1 $4 $-1 $1 #")

    Your routine would search for the two point lines I.e.

    (1 . "point $-1 -1 $-1 25 0 -50 #")
    (1 . "point $-1 -1 $-1 25 0 50 #")

    where  25,0,-50 and 25,0,50 are the coordinates of each end of the cylinder. The most accurate method would be to use these points as a direction or vector of the cylinder. Using this direction you would align the solid with WCS. then use the GetBoundingBox to get the dimensions.

    If your cylinder is guaranteed not to be mitered, then you can just use the difference between these two points for your length and pull you radius from  ACIS/SAT (1 . " ellipse-curve...

    Clear as mud? : )

    Daniel

     

  • Thank you Daniel,

    I made it with lisp, thank you for your help, but the reason why I wanted a solution in VBA was to get the data in an excel-sheet without an csv or txt file. Is there any documentation about the vba api of bricscad?

    holger

This discussion has been closed.