Can't access AppearanceAssets from a derived part.

Can't access AppearanceAssets from a derived part.

nooraldeen.saleem
Participant Participant
336 Views
4 Replies
Message 1 of 5

Can't access AppearanceAssets from a derived part.

nooraldeen.saleem
Participant
Participant

I am trying to select an appearance in a derived part using

 

oApp = oPartDoc.AppearanceAssets.Item(App_name)

 

However the oPartDoc is a derived document that I had to select with the help of 

 

Dim oPartDoc As Document

For Each oPartDoc In ThisApplication.Documents.VisibleDocuments

    If oPartDoc Is Nothing Then
        'MsgBox "Missing Inventor Part Document"
        Exit Sub
    End If
    	
    	If Left(oPartDoc.DisplayName,13) = "example_1.ipt" Or Left(oPartDoc.DisplayName,13) = "example_2.ipt" Or Left(oPartDoc.DisplayName,13) = "example_3.ipt" Then
        
			Exit For
		End If
Next

 

But since oPartDoc is a Document and not a PartDocument i cant access the AppearanceAssets shown in the first code. I tried to change it to PartDocument but it doesn't like it. Can someone at least tell me if I'm thinking wrong about how to solve this? Thanks 🙂

 

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

Andrii_Humeniuk
Advisor
Advisor
Accepted solution

Hi @nooraldeen.saleem . Not sure I understand you, but here is an example of how you can get the ActiveAppearance in your detail.

Dim oDoc As Document = ThisApplication.ActiveDocument
If TypeOf oDoc Is PartDocument Then
	Dim oPartDoc As PartDocument = oDoc
	Dim oAsset As Asset = oPartDoc.ActiveAppearance
	MessageBox.Show(oAsset.Name, "Active AppearanceAsset")
Else
	MessageBox.Show("Active document is not PartDocument!", "Error!",MessageBoxButtons.OK,MessageBoxIcon.Error)
End If

Andrii Humeniuk - CAD Coordinator, Autodesk Certified Instructor

LinkedIn | My free Inventor Addin | My Repositories

Did you find this reply helpful ? If so please use the Accept as Solution/Like.

EESignature

Message 3 of 5

nooraldeen.saleem
Participant
Participant
This Solved It Thank you very much 🙂
Message 4 of 5

WCrihfield
Mentor
Mentor

Hi @nooraldeen.saleem.  Are you saying that you currently have a PartDocument visibly open on your screen (the 'active' document), and there is another PartDocument derived into this active one, and you want to access a specifically named appearance type Asset object within that 'other' PartDocument?  When dealing with 'derived' stuff, that subject can be very confusing, so you need to be very clear in your wording so that we correctly understand the situation.  If what I described above is not the situation you are referring to here, then please describe the situation in as much detail as possible.  Also, what do you intend to do with this appearance type Asset object once you get a reference to it?  The 'other' document (the PartDocument you have derived into this 'active' one) does not know about or contain any link to the 'active' document that it has been derived into.  But the 'active' document that the 'other' document has been derived into will know about the 'other' document, and will contain a link to it.

Wesley Crihfield

EESignature

(Not an Autodesk Employee)

0 Likes
Message 5 of 5

nooraldeen.saleem
Participant
Participant
Actually your spot on. I am in a PartDocument lets call it part (1) and there is another PartDocument lets call it the shrink wrap (because that's what it is) that open and visible in inventor Now you are right the shrink wrap is not derived from part (1) but it is a shrink wrap of the assembly that part (1) is in. My goal is to find a specified surface in that other document and change its appearance. Which I have now accomplished. And if your wondering why am doing this well I want to use the appearance as a marker to apply other features to the surface. If you have further questions I will be happy to reply 🙂
0 Likes