How to auto update dependency properties in toolkit features from automation

whinnycampingMechanics

Nov 5, 2013 (3 years and 11 months ago)

106 views

How to auto update
dependency

properties in toolkit features from
automation


The Evaluate method shou
l
d not
be
called
any
more.


The

PropertiesAutoUpdate


property has been
added to the Audi and VW features.

By default his property is set to false and
its value is not serialized together the feature.

1.

When this property is set to

False


the dependency feature properties do not automatically
update their value with the modified one.

2.

When this property is set to
‘True’

the dependency feature properties do

automatically
update their value with the modified one.


The properties that cause automatic update
s

are:

Audi Features:



FUNCTIONAUDI, FUNCTIONVW, MEASAUDI, NAMINGRULE, ASSEMBLYID,

COUNTER, ISLEFT, DP1PNT_T, DP1PNT
_T, DP1_ERULE,
DP2PNT_T, DP2PNT_T, DP2_E
RULE,

DP3PNT_T, DP3PNT_T, DP3_ERULE, DP4PNT_T, DP4PNT_T, DP4_ERULE,

DP5PNT_T, DP5PNT_T, DP5_ERULE


These properties cause the automatic regeneration

of :


Internal Point IDs, Internal Dimension IDs,T1 and T2 comments.




RMEASFEATUREX
, RMEASFEATUREY,
RMEASFEATUREZ


These properties cause the automatic regeneration of
:


T2 comments.




DP1_ID,
DP2_ID, DP3_ID, DP4_ID, DP5_ID


These properties cause the automatic regeneration of
:

T1 and T2 comments.




DP1_T2,
DP2_T2, DP3_T2, DP4_T2, DP5_T2


These properties
cause

the automatic regeneration of
:

T2 comments.

VW Features:



FUNCTIONAUDI, FUNCTIONVW, MEASAUDI, NAMINGRULE, ASSEMBLYID,

COUNTER, ISLEFT,
DP1PNT_T, DP1PNT_T, DP1_ERULE,
DP2PNT_T, DP2PNT_T, DP2_ERULE,

DP3PNT_T, DP3PNT_T, DP3_ERULE, DP4PNT_T, DP4PNT_T, D
P4_ERULE
,
PPP1PNT_T,
PPP1PNT_T, PPP1_ERULE, PP
P2PNT_T, PPP2PNT_T, PPP2_ERULE

These properties cause

the automatic regeneration of
:


Intenal Point IDs
, Internal Dimension ID
s
, T1 and T2 comments.




RMEASFEATUREX
, RMEASFEATUREY, RMEASFEATUREZ


These propertie
s cause

the automatic regeneration of
:

T2 comments.




DP1_ID, DP2_ID, DP
3_ID, DP4_ID, PPP1_ID, PPP2_ID


These properties cause

the automatic regeneration of
:


T1 and T2 comments.




DP1_T2,

DP2_T2, DP3_T2, DP4_T2, PPP1_T2


These properties cause

the automatic regeneration of
:

T2 comments.


To set and reset the

PropertiesAutoUpdate


value from automation the following commands should
be used:


To set: res = i_Cmd.PutToolkitData(True, "PropertiesAutoUpdate")


To reset: res = i_Cmd.PutT
oolkitData(False, "PropertiesAutoUpdate")

When the changes
for a feature are completed
you must set it back to false. This call
s
internally
Evaluate
()
.

Feature properties can
not

get changed if the feature dialog is
open
!


VB.Net
code sample
:


Private

Sub

Btn_ModifyEEPNT1_Click(
ByVal

sender
As

System.Object, _


ByVal

e
As

System.Windows.RoutedEventArgs) _


Handles

Btn_ModifyEEPNT1.Click


Try



Dim

res
As

Boolean

= i_Cmd.PutToolkitData(
True
,
"PropertiesAutoUpdate"
)


Dim

value
As

Boolean


value =
CType
(i_Cmd.GetToolkitData(
"PropertiesAutoUpdate"
).ToString,
Boolean
)



If

Not

res
OrElse

Not

value
Then


' i.e. because th
e feature dialog is opened


Throw

New

Exception(
"Couldn't set PropertiesAutoUpdate to TRUE"
)


End

If



' Changes the ID of DP1 to DP1_Test


If

i_Cmd.PutToolkitData(
"DP1_Test"
,
"DP1_ID"
)
Then


If

i_Cmd.PutToolkitData(
False
,
"PropertiesAutoUpdate"
)
Then


MessageBox.Show(
"Successfully change ID of DP1"

& vbCrLf & vbCrLf & _


"Previuos ID was: "

& i_DP1_ID & vbCrLf & _


"New ID is: DP1_Test"
, _


"DP1_ID of EEPNT1 has been changed"
, _


MessageBoxButton.OK, MessageBoxImage.Information)


Btn_Evaluate.I
sEnabled =
True


Btn_ModifyEEPNT1.Background = Brushes.LightGreen



Label3.Content = Label3.Content.ToString &
" DP1=DP1_Test"


Label13.Content = Label13.Content.ToString &
" DP1=DP1_Test"



Else


Throw

New

Exception(
"Couldn't set PropertiesAutoUpdate to FALSE"
)


End

If



End

If



Catch

ex
As

Exception


MessageBox.Show(ex.Message,
"Btn_ModifyEEPNT1_Click"
, _


MessageBoxButton.OK, MessageBoxImage.Exclamation)


End

Try



End

Sub