Community
Inventor Programming - iLogic, Macros, AddIns & Apprentice
Inventor iLogic, Macros, AddIns & Apprentice Forum. Share your knowledge, ask questions, and explore popular Inventor topics related to programming, creating add-ins, macros, working with the API or creating iLogic tools.
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Improve Multi Faces color overwriting

3 REPLIES 3
SOLVED
Reply
Message 1 of 4
fsanchou
396 Views, 3 Replies

Improve Multi Faces color overwriting

Hi,

 

Manually If I double-click on a face to select also tangented faces, overwriting take few seconds (less 2 seconds) for 20 faces.

 

With code below, this operation take more 16 seconds for the sames 20 faces!

 

Which commands is use by manual method or how improve it?

 

Thanks

 

Dim oPartDoc As PartDocument
oPartDoc = ThisApplication.ActiveDocument

Dim oFace As Face
Try
	oFace = oPartDoc.SelectSet.Item(1)
Catch
	Exit Sub
End Try


Dim oColorAsset As Asset
Try
	oColorAsset = oPartDoc.AppearanceAssets.Item("Or")
Catch
	Exit Sub
End Try


oFace.Appearance = oColorAsset

Dim oTangentedface As Face

For Each oTangentedface In oFace.TangentiallyConnectedFaces
	oTangentedface.Appearance = oColorAsset
Next
Tags (4)
3 REPLIES 3
Message 2 of 4
YuhanZhang
in reply to: fsanchou

Can you attach a data to reproduce the problem? Don't attach confidential data.



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Message 3 of 4
fsanchou
in reply to: YuhanZhang

Hi @YuhanZhang,

 

As I can't send confidential data, I wanted to create a sample data sample.

And of course, in sample data, code works correctly ... 😉

 

So by exploring my data, I found problem comes from flatpattern update!

 

By adding code bellow, that works correctly:

oPartDoc.FlatPatternSettings.DeferUpdate = True
'..... execution
oPartDoc.FlatPatternSettings.DeferUpdate = False

Thanks

 

 

Message 4 of 4
YuhanZhang
in reply to: fsanchou

Glad to hear you solved it by yourself:).



If this solves the problem please click ACCEPT SOLUTION so other people can find it easily.



Rocky Zhang
Inventor API PD
Manufacturing Solutions
Autodesk, Inc.

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report