iLogic Select Face add Color

iLogic Select Face add Color

dusan.naus.trz
Advisor Advisor
699 Views
2 Replies
Message 1 of 3

iLogic Select Face add Color

dusan.naus.trz
Advisor
Advisor

Hello,

Not implemented (Exception from HRESULT: 0x80004001 (E_NOTIMPL))
I wanted to simplify my work when choosing the most common colors.
Problem when I had a document open in Assembly. Please watch the video. Files in the attachment. The files are in a version of Inventor 2020
I tried ThisApplication.ActiveEditDocument, mostly this command works. But there was another mistake. I do not know what it means.

Please, what should I do to make it work? What did I do wrong?

2019-10-31_12h01_15.png

Dim oDoc As Document = ThisApplication.ActiveEditDocument
'Dim oDoc As Document = ThisDoc.Document
Dim oCD As ComponentDefinition = oDoc.Componentdefinition
InventorVb.DocumentUpdate()

oDef = oDoc.ComponentDefinition

'define appearance library by name
Dim assetLib As AssetLibrary
'assetLib = ThisApplication.AssetLibraries.Item("Autodesk Appearance Library")

'sColor1 = "Gold"

oLanguage = ThisApplication.LanguageName
If oLanguage = "English" Then
	assetLib = ThisApplication.AssetLibraries.Item("Autodesk Appearance Library")
	'English Code Here.
	sColor1 = "Cyan"
	textvyberu = "Select Face"
ElseIf oLanguage = "Czech" Then
	assetLib = ThisApplication.AssetLibraries.Item("Knihovna vzhledů Autodesk")
	textvyberu = "Vyber Plochy"
	'Czech Code Here.
	sColor1 = "Světle modrá"
End If
'iLogicVb.UpdateWhenDone = True

'define colors to work with
Dim libAsset1 As Asset
libAsset1 = assetLib.AppearanceAssets.Item(sColor1) 

' try to Copy the asset locally.
Try
	localAsset1 = libAsset1.CopyTo(oDoc)
Catch
'assume error means it's already local
	localAsset1 = oDoc.Assets(sColor1)
End Try

Line1:
'Dim oSolid As SurfaceBody = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartBodyFilter, "Select SolidBody")
'Dim oSolid As SurfaceBody = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartBodyFilter, "Vyber Tělesa")
Dim oFace As Face = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kPartFaceFilter, textvyberu)
If oFace Is Nothing Then Exit Sub
'oSolid.Visible = False

Me_Color = oDoc.Assets(sColor1)
oFace.Appearance = Me_Color

GoTo Line1

 

0 Likes
700 Views
2 Replies
Replies (2)
Message 2 of 3

WCrihfield
Mentor
Mentor

If the assembly was active when you started your rule, even if it is in Edit Part Mode, it still sees the assembly as both ActiveDocument and ActiveEditDocument.  If you want to edit the Part from the assembly, you'll have to call out either that Reference Document, or that ComponentOccurrence.Definition.Document.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 3 of 3

ianteneth
Advocate
Advocate

Hi @dusan.naus.trz,

 

When I have seen that error before it literally meant that Autodesk had not yet implemented that code in the API. They later added it in an update, though. Just my thoughts. Here is a link to my question where this was the issue.

 

https://forums.autodesk.com/t5/inventor-customization/assembly-hole-feature-depth-bug/m-p/9163411/hi... 

0 Likes