VBA Polyline area!

Discussion in 'AutoCAD' started by bathingape, May 20, 2004.

  1. bathingape

    bathingape Guest

    Hi,

    I'm new to AutoCAD and I was hoping to see if anyone has had any experience with getting the area property of a polyline using VBA.

    I came across some mentioning using VisualLisp (I think) but the problem is that I'm more familiar with the VBA environment and I was hoping to see if any of you guys have experience with it and getting a polyline area.

    So far, I've been using the ModelSpace collection to retrieve the objects in it like the ObjectName and Color. However I can't seem to capture (if that's the correct word) the properties associated with the polyline such as Area, Coordinates, et cetera.

    I'm actually using something like this (x is a Double):
    x = ThisDrawing.ModelSpace(i).Area

    But it keeps telling me that it's an invalid property or the object doesn't support this method.

    The reason why I'm trying to get into code is because I have almost a thousand polylines that are in a rectangular shape and I want to insert a block on each of those shapes and I need to specify the dimensions of that rectangle.

    Anyhelp or even suggestions would be really appreciated.

    Thanks,
    d.
     
    bathingape, May 20, 2004
    #1
  2. In addition to any replies you might receive or already
    received, you may find more information or responses
    by posting future VBA related questions in the following
    discussion group:

    By NNTP discussion group reader at
    news://discussion.autodesk.com/autodesk.autocad.customization.vba

    By HTTP (web-based) interface at
    http://discussion.autodesk.com/forum.jspa?forumID=33


    --

    Autodesk Discussion Group Facilitator


    <snip>
     
    Jason Piercey, May 20, 2004
    #2
  3. bathingape

    Jürg Menzi Guest

    bathingape

    - It would be better to post questions concerning VBA in the customization.vba
    newsgroup.
    - The object collection contains objects without the area property. Yo've to
    use an object check:

    For i = 0 to MspaceColl.Count - 1
    If MspaceColl(i).ObjectName = "AcDbPolyline" Then
    x = MspaceColl(i).Area
    'do the other stuff
    End If
    Next i

    Cheers
     
    Jürg Menzi, May 20, 2004
    #3
  4. bathingape

    bathingape Guest

    Thanks so much guys.

    I will definately be posting my queries at the VBA forum. The thing was that I saw the General Customization and thought it wouldn't hurt to try my luck.

    Thanks!
     
    bathingape, May 21, 2004
    #4
  5. bathingape

    Jürg Menzi Guest

    Glad to help you...

    Cheers
     
    Jürg Menzi, May 22, 2004
    #5
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.