Selection by pickObject - Reference object to be set an instance of an object
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
The below code, i have found that example like everywhere but whenever i try to execute that example i get
"Object reference not set to an instance of an object."
exception in the line of get_parameter?
Task dialog line works so the selection is successful.
If you had any solution or anybody had this problem before i would love to hear a solution.
Regards
Selection sel = uidoc.Selection;
Reference hasPickOne = sel.PickObject(ObjectType.Element);
if (hasPickOne != null && hasPickOne.ElementId != ElementId.InvalidElementId)
TaskDialog.Show("Element", "Element selected");
Element selectedElement = doc.GetElement(hasPickOne);
double x = selectedElement.get_Parameter(BuiltInParameter.BASEPOINT_EASTWEST_PARAM).AsDouble();
double y = selectedElement.get_Parameter(BuiltInParameter.BASEPOINT_NORTHSOUTH_PARAM).AsDouble();