arc properties

Discussion in 'AutoCAD' started by ljb, Jul 14, 2003.

  1. ljb

    ljb Guest

    Why do some AcadArc entities have a startangle and endangle but not
    startpoint and endpoint? Startangle and Endangle are recognized as valid
    properties of the problem arc. Try to check Startpoint or Endpoint and I get
    "run-time error '451' Property let procedure not defined and property get
    procedure did not return an object". If I check with lbound(arc.startpoint)
    it returns 0 and ubound(arc.startpoint) returns 2. Yet every attempt to
    access arc.startpoint(0) gives me the error.

    thanks
    LJB
     
    ljb, Jul 14, 2003
    #1
  2. ljb

    ljb Guest

    What would I ever do without the help I receive from this newsgroup?!?!
     
    ljb, Jul 14, 2003
    #2
  3. ljb

    ljb Guest

    In my case I have to pass the entity to another subroutine. Passing it as a variant or object sometimes I can't get to the properties. However passing it as a specific type fixes it every time.



    "joesu" <> wrote in message news:...

    There is no need to cast the objects to AcadArc. Here is an example.

    Joe
    --

    Public Sub ArcDetail() Dim oSS As AcadSelectionSet Dim oEntity As AcadEntity Dim iFilterCode(0) As Integer Dim vFilterValue(0) As Variant

    On Error Resume Next   Application.ActiveDocument.SelectionSets("Arcs").Delete   On Error GoTo 0

    Set oSS = Application.ActiveDocument.SelectionSets.Add("Arcs")   iFilterCode(0) = 0: vFilterValue(0) = "Arc"   oSS.SelectOnScreen iFilterCode, vFilterValue   If oSS.Count Then     For Each oEntity In oSS       Dim oArc As AcadArc       Set oArc = oEntity       With oArc         MsgBox "StartPoint: " & .StartPoint(0) & ", " & .StartPoint(1) & ", " & .StartPoint(2) & vbCrLf & _                "EndPoint : " & .EndPoint(0) & ", " & .EndPoint(1) & ", " & .EndPoint(2)       End With     Next oEntity   End If End Sub
     
    ljb, Jul 17, 2003
    #3
  4. ljb

    ljb Guest

    True, VB doesn't have anything to cast a variable to another type. In my
    case it was really assignment to another type as in:

    Dim v as Variant
    Dim arc as AcadArc

    Set arc = v

    y = v.xx 'may not always work
    y = arc.xx 'reveals the properties OK
     
    ljb, Jul 17, 2003
    #4
  5. ljb

    joesu Guest

    Hi James,

    Assume you have an unfiltered selection set [oSS] and you want to get at the start and end points of a line object

    For Each oEntity In oSS   If TypeOf oEntity Is AcadLine Then     Set oLine = oEntity 'cast the generic entity to a line     MsgBox oLine.StartPoint(0) ...   End If Next oEntity

    In this example, you cast the generic object of AcadEntity datatype to be the more specific AcadLine datatype. You do this because the AcadEntity datatype does not support a StartPoint or EndPoint property. Does this help clear up the confusion a bit?

    Joe
    --
     
    joesu, Jul 17, 2003
    #5
  6. No confusion here, Joe... I was just mis-reading your post and inferring
    things. You said there is no need to cast, and then your example *appeared*
    to cast... or at least the VBA equivalent of casting. So I thought I saw a
    contradiction. But I guess you were saying, roughly... "You don't need to
    cast -- instead, you should hold it in an AcadArc variable"

    James
     
    James Belshan, Jul 17, 2003
    #6
  7. ljb

    joesu Guest

    Actually my ArcDetails routine is incorrect. It has a cast which is not necessary since I'm creating a filtered selection of just arcs. Here is the corrected version.

    Joe
    --

    Public Sub ArcDetail() Dim oSS As AcadSelectionSet Dim oArc As AcadArc Dim iFilterCode(0) As Integer Dim vFilterValue(0) As Variant

    On Error Resume Next   Application.ActiveDocument.SelectionSets("Arcs").Delete   On Error GoTo 0

    Set oSS = Application.ActiveDocument.SelectionSets.Add("Arcs")   iFilterCode(0) = 0: vFilterValue(0) = "Arc"   oSS.SelectOnScreen iFilterCode, vFilterValue   If oSS.Count Then     For Each oArc In oSS       With oArc         MsgBox "StartPoint: " & .StartPoint(0) & ", " & .StartPoint(1) & ", " & .StartPoint(2) & vbCrLf & _                "EndPoint : " & .EndPoint(0) & ", " & .EndPoint(1) & ", " & .EndPoint(2)       End With     Next oArc   End If End Sub
     
    joesu, Jul 17, 2003
    #7
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.