Is there any iLogic Code can get ModelName from existed General Table?

Is there any iLogic Code can get ModelName from existed General Table?

ngdnam88
Advocate Advocate
321 Views
4 Replies
Message 1 of 5

Is there any iLogic Code can get ModelName from existed General Table?

ngdnam88
Advocate
Advocate

Dears,

Please help me, I'm looking for an iLogic Code can get the ModelName that used in the General Table:

ngnam1988_0-1660401520339.png

Thanks you very much!

 

0 Likes
Accepted solutions (1)
322 Views
4 Replies
Replies (4)
Message 2 of 5

A.Acheson
Mentor
Mentor

Very simple example shown in this post. Here is the API help for the Custom table object

If this solved a problem, please click (accept) as solution.‌‌‌‌
Or if this helped you, please, click (like)‌‌
Regards
Alan
0 Likes
Message 3 of 5

ngdnam88
Advocate
Advocate

Thanks @A.Acheson

But seem my question is not clear. I mean the iLogic Code can get the ModelName that used for this table (When I run the iLogic rule, it'll return the name of Model Reference) - Not need access cell's value in the General Table.

I know some code that can get ModelDocument in the Drawing, and ModelDocument in the View but didn't found one for General Table,

0 Likes
Message 4 of 5

Michael.Navara
Advisor
Advisor
Accepted solution

You can try this snippet

Dim drw As DrawingDocument = ThisDoc.Document
Dim table As CustomTable = drw.ActiveSheet.CustomTables(1)

If table.ReferencedDocumentDescriptor Is Nothing Then
	Logger.Warn("Table has no referenced document")
	Return
End If

Dim docDescriptor = TryCast(table.ReferencedDocumentDescriptor, DocumentDescriptor)
If docDescriptor IsNot Nothing Then
	Logger.Info(docDescriptor.FullDocumentName)
	Return
End If

Dim fileDescriptor = TryCast(table.ReferencedDocumentDescriptor, FileDescriptor)
If fileDescriptor IsNot Nothing Then
	Logger.Info(fileDescriptor.FullFileName)
	Return
End If

 

Message 5 of 5

ngdnam88
Advocate
Advocate

Thanks @Michael.Navara ,

Your Code is working perfectly. I got the error when using Logger.Info() - Maybe my Inventor version is not support iLogic Logging.

I replaced by MessageBox.Show() and all code are working in the correct.

Thanks you very much!

0 Likes