Improve Multi Faces color overwriting

Improve Multi Faces color overwriting

fsanchou
Advocate Advocate
488 Views
3 Replies
Message 1 of 4

Improve Multi Faces color overwriting

fsanchou
Advocate
Advocate

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
0 Likes
Accepted solutions (1)
489 Views
3 Replies
Replies (3)
Message 2 of 4

YuhanZhang
Autodesk
Autodesk

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.

0 Likes
Message 3 of 4

fsanchou
Advocate
Advocate
Accepted solution

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
Autodesk
Autodesk

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.

0 Likes