cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Adding Soft Attributes with constraints to WTPart through XML

praseeth.moothe
1-Newbie

Adding Soft Attributes with constraints to WTPart through XML

Hi All,


Is there a way to write an XML, to add some softattributes to wt.part.WTPart. Also, add some constraints to those attributes.? These have to be done through XML, so that we can avoid manual creation of attributes and constraints.


10 REPLIES 10

Look in the $WT_HOME/loadFiles directory.

To use, see the data loader pdf guide.




Sent from my Verizon Wireless BlackBerry

Hi David,

It didn't help. There are XMLs for creating a new soft type and adding
attributes with constraints. But there are no samples of XML for updating
wt.part.WTPart.

I tried and was able to add a soft attribute to WTPart, but could not add a
constraint to that attribute. No idea where I am going wrong.

Praseeth M

yes it is possible. for sample xml export existing type/softtype definition using export/import manager (it will be zip format having xml) and modify it as per your requirement.

you can import this zip/ rar to create new type definition..

Regards,
Dhananjay Sandbhor

Something like this?

<csvattrdefinizer handler="wt.iba.definition.DefinitionLoaderWithCache.createAttrDefinizer">
<csvname> LICENSE_REQUIRED </csvname>
<csvhierarchydisplayname> LICENSE_REQUIRED </csvhierarchydisplayname>
<csvorganizerpaths>Parts</csvorganizerpaths>
<csvdefinitionpaths/>
<csvdisplay_name> LICENSE_REQUIRED </csvdisplay_name>
<csvdescription></csvdescription>
<csvdata_type>string</csvdata_type>
<csvqomname/>
<csvnamevaluepairs/>
<csvlogicalidentifier> LICENSE_REQUIRED </csvlogicalidentifier>
</csvattrdefinizer>

<csvbegintypedefnode<br/> handler="com.ptc.core.meta.type.mgmt.server.impl.TypeDefinitionNodeLoader.beginUpdateTypeDefinitionNode">
<csvnodename> customPart </csvnodename>
<csvparenthid>wt.part.WTPart|customPart</csvparenthid>
<csviconfile>part.gif</csviconfile>
<csvdescription>Custom part</csvdescription>
<csvdisplayname> customPart </csvdisplayname>
<csvhierarchydisplayname> customPart </csvhierarchydisplayname>
<csvinstantiable>TRUE</csvinstantiable>
<csvdeleted>FALSE</csvdeleted>
<csvuserattributable>TRUE</csvuserattributable>
<csvlogicalidentifier> customPart </csvlogicalidentifier>
<csvaddsinglevaluedconstraint>FALSE</csvaddsinglevaluedconstraint>
</csvbegintypedefnode>

<csvtypedefconsvalue<br/> handler="com.ptc.core.meta.type.mgmt.server.impl.TypeDefinitionNodeLoader.createConstraintValue">
<csvbindingrule>SINGLE_ATTRIBUTE_BINDING_RULE</csvbindingrule>
<csvenforcementrule>com.ptc.core.meta.container.common.impl.DiscreteSetConstraint</csvenforcementrule>
<csvbindingruledata>LICENSE_REQUIRED</csvbindingruledata>
<csvenforcementruledata>Yes|No|Verify</csvenforcementruledata>
</csvtypedefconsvalue>

Thanks
Chris

I do it all the time, key is looking in the DTD file for the right tag.


Sent from my Verizon Wireless BlackBerry

Hi Chris,


This will add the constarints to an attribute of a softtype of WTPart. But have you tried adding this constraint to the WTPart itself?

The effect is the same, drop the soft typed reference and just refer to the
modeled object wt.part.WTPart and it should work the same.


Hi Chris/David,


Are you sure the given XML worked for you? For me it throws an error in the method server- '


The value for attribute<attribute_name> must be one of the following:<list_of_values_given_for_discrete_set>;.


For me, If I remove the DiscreteSet constraint and add ValueRequiredConstraint, it works fine. SO it seems there is some problem with the DiscreteSetConstraint in the way I am giving the values.

Hi guys,


Thanks for the help. But the one which worked for me is given below. The attribute has already been created before running this file using another XML.




<nmloader>



<csvtypenodeiconroot<br/>handler="com.ptc.core.meta.type.mgmt.server.impl.TypeDefinitionNodeLoader.getIconRoot">
<csviconroot>wtcore/images</csviconroot>
</csvtypenodeiconroot>


<csvbegintypedefnode<br/>handler="com.ptc.core.meta.type.mgmt.server.impl.TypeDefinitionNodeLoader.beginUpdateTypeDefinitionNode">
<csvnodename>wt.part.WTPart</csvnodename>
<csvparenthid></csvparenthid>
<csviconfile>part.gif</csviconfile>
<csvdescription>Part</csvdescription>
<csvdisplayname>Part</csvdisplayname>
<csvhierarchydisplayname>Part</csvhierarchydisplayname>
<csvinstantiable>true</csvinstantiable>
<csvdeleted>false</csvdeleted>
<csvuserattributable>true</csvuserattributable>
<csvlogicalidentifier>wt.part.WTPart</csvlogicalidentifier>
</csvbegintypedefnode>

<csvtypedefattrvalue<br/>handler="com.ptc.core.meta.type.mgmt.server.impl.TypeDefinitionNodeLoader.createAttributeValue">
<csvdefinition>DiscreteAttrTest</csvdefinition>
<csvvalue1>Value1</csvvalue1>
</csvtypedefattrvalue>

<csvtypedefconsvalue<br/>handler="com.ptc.core.meta.type.mgmt.server.impl.TypeDefinitionNodeLoader.createConstraintValue">
<csvbindingrule>SINGLE_ATTRIBUTE_BINDING_RULE</csvbindingrule>
<csvenforcementrule>com.ptc.core.meta.container.common.impl.DiscreteSetConstraint</csvenforcementrule>
<csvbindingruledata>DiscreteAttrTest</csvbindingruledata>
<csvenforcementruledata>Value1|Value2|Value3</csvenforcementruledata>
</csvtypedefconsvalue>

<csvendtypedefnode<br/>handler="com.ptc.core.meta.type.mgmt.server.impl.TypeDefinitionNodeLoader.endUpdateTypeDefinitionNode" />
</nmloader>

Not having ever seen your error message or file, no one can really help. However, glad you got it working. If this is for Windchill 9 or 10, I would avoid using the older standard DTD files.

Sent from my Verizon Wireless BlackBerry
Announcements