How to convert a Reference to something useful?

How to convert a Reference to something useful?

Anonymous
Not applicable
1,599 Views
2 Replies
Message 1 of 3

How to convert a Reference to something useful?

Anonymous
Not applicable

I'm trying to use the PickObjects method and judging by the lack of documentation and examples out there, it's not a good direction to go.  But regardless, it returns an array of References.  So now what?  How can I cast that Reference something useful, like a Wall or Beam?

 

        Dim pickedObjs As IList(Of Reference) = sel.PickObjects(ObjectType.Element, "Please select objects")
        For Each PO In pickedObjs
            Dim CurObj As Element = PO
        Next

 

0 Likes
Accepted solutions (1)
1,600 Views
2 Replies
Replies (2)
Message 2 of 3

Anonymous
Not applicable
Accepted solution

I figured it out...

 

Dim sd As Element = m_rvtDoc.GetElement(PO.ElementId)

 

 

A follow up question... When finding the end points of an edge of a solid, what is the syntax for the "EndPointReference" method?

 

I'm using this, but it's only returning a "nothing" value.

 

Dim HDAr As Reference = EELine.EndPointReference(0)

 

 

0 Likes
Message 3 of 3

Joe.Ye
Alumni
Alumni

 

About the last question.

 

After you construct the Options object, you need to assign the Options.ComputerReferences = True.

Only in this way, the reference of geometry object can be retrieved.

 



Joe Ye
Contractor
Developer Technical Services
Autodesk Developer Network
0 Likes