09-22-2020
10:01 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
09-22-2020
10:01 AM
First of all, if you know what Type of object it is going to be you can create your variable as that type of object, instead of just Object. That will make things easier. If you are not sure which type of object you might be retrieving, you can check the .Type of the Object against some expected ObjectTypeEnum variances, after you've retrieved it. You can retrieve the 'readable' name of the objects Type using this line:
Dim oObj As Object = iLogicVb.Automation.GetNamedEntities(ThisDoc.Document).TryGetEntity("Entity's Name")
If oObj IsNot Nothing Then
oTypeName = [Enum].GetName(GetType(ObjectTypeEnum), oObj.Type)
End Ifor you can use something like this to check if is one a few Types you're possibly expecting:
Dim oObj As Object = iLogicVb.Automation.GetNamedEntities(ThisDoc.Document).TryGetEntity("Entity's Name")
Dim oType As String
If oObj IsNot Nothing Then
Select Case oObj.Type
Case ObjectTypeEnum.kFaceObject
oType = "Face"
Case ObjectTypeEnum.kEdgeObject
oType = "Edge"
Case ObjectTypeEnum.kVertexObject
oType = "Vertex"
End Select
End If
If oType = "Face" Then
'so on and so forthIf it's a face object, you can do something similar to what that other post has done.
Or you can access the documents StylesManager, then its available styles to choose one to apply.
Wesley Crihfield
(Not an Autodesk Employee)