Announcements
Attention for Customers without Multi-Factor Authentication or Single Sign-On - OTP Verification rolls out April 2025. Read all about it here.
WCrihfield
in reply to: J-Camper

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 If

or 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 forth

 If 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

EESignature

(Not an Autodesk Employee)