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

Community Tip - Need to share some code when posting a question or reply? Make sure to use the "Insert code sample" menu option. Learn more! X

How to read each constraint from file for Attribute

KU_9877195
4-Participant

How to read each constraint from file for Attribute

I get the below information when i call the function ((AttributeDefinitionReadView) typeAtribs).getAllConstraints() on type EPMDocument

 

[@@@ BEGIN CONSTRAINT Definition

loadID: null
contextId: com.ptc.core.lwc.server.LWCTypeDefinition:9906
attName: docSubType
conditions: null
conditionFor: null
deleted: false
rule: com.ptc.core.meta.container.common.impl.SingleValuedConstraint:com.ptc.core.lwc.server.LWCBasicConstraint:3348:null
ruleDataObj: @@@ BEGIN Rule Data Object

ruleData: -[ ]
@@@ END Rule Data Object

properties: 
readViewId: null
@@@ End CONSTRAINT Definition
, @@@ BEGIN CONSTRAINT Definition

loadID: null
contextId: com.ptc.core.lwc.server.LWCTypeDefinition:9906
attName: docSubType
conditions: null
conditionFor: null
deleted: false
rule: com.ptc.core.meta.container.common.impl.StringByteLengthConstraint:com.ptc.core.lwc.server.LWCBasicConstraint:3348:null
ruleDataObj: @@@ BEGIN Rule Data Object

ruleData: [0,200]
@@@ END Rule Data Object

properties: 
readViewId: null
@@@ End CONSTRAINT Definition
, @@@ BEGIN CONSTRAINT Definition

loadID: null
contextId: com.ptc.core.lwc.server.LWCTypeDefinition:9906
attName: docSubType
conditions: null
conditionFor: null
deleted: false
rule: com.ptc.core.meta.container.common.impl.StringLengthConstraint:com.ptc.core.lwc.server.LWCBasicConstraint:3348:null
ruleDataObj: @@@ BEGIN Rule Data Object

ruleData: [0,200]
@@@ END Rule Data Object

properties: 
readViewId: null
@@@ End CONSTRAINT Definition
, @@@ BEGIN CONSTRAINT Definition

loadID: null
contextId: com.ptc.core.lwc.server.LWCTypeDefinition:9906
attName: docSubType
conditions: null
conditionFor: null
deleted: false
rule: com.ptc.core.meta.container.common.impl.DiscreteSetConstraint:com.ptc.core.lwc.server.LWCBasicConstraint:3348:null
ruleDataObj: @@@ BEGIN Rule Data Object

ruleData: [ECAD-HOOK-PROPAGATE-DESIGN-ATTRIBUTE-VALUES,ECAD-HOOK-RETRIEVE-DESIGN-ATTRIBUTE-VALUES,ECAD-HOOK-GET-DESIGN-DIRECTORY,ECAD-HOOK-GET-DESIGN-ITEM-LIST,ECAD-HOOK-PRE-UPDATE,ECAD-HOOK-CREATE-DESIGN-FILES-LIST,ECAD-HOOK-VALIDATE-DESIGN,ECAD-HOOK-CREATE-ATTACHMENT-LIST,ECAD-HOOK-GET-NEUTRAL-FORMAT-ITEM-LIST,ECAD-HOOK-CREATE-GENERIC-BOM,ECAD-HOOK-CREATE-NEUTRAL-FORMAT-FILES,ECAD-HOOK-CREATE-VARIANT-BOM,ECAD-HOOK-CREATE-VIEWABLE,BULKTEMPLATE,CASTINGCAVITY,CMM,COMPOSITE,CONCEPT-MODEL,DESIGN,DIEFACE,EXPERTMACHINIST,EXTERNALSIMPREP,HARNESS,INTERCHANGE,MOLDCAVITY,MOLDLAYOUT,NCASSEMBLY,NCMODEL,NCPART,PROCESSPLAN,REGENERATED-BACKUP,SHEETMETAL,WELDMENT,SOLID,VERIFY,SKEL_MODEL,OTHER,PACKAGE,PRESENTATION,XREF,ADRAW,ILLUSTRATION,MANIKIN,MANIKIN_SEGMENT,CONTAINER,ECAD-DERIVED-OBJECT-FOR-ASSM,CGR,DRAWFORM,ASMCGR,TEMPLATE,CATGSCRIPT,CATSCRIPT,VBSCRIPT,REPORT,DOCUMENT,MOVIE,IMAGE,CONFIGURATION_MODULE,CONFIGURATION_ASSEMBLY,ECAD_ASM,ECAD_BOARD_PART,ALLINONECATPART,CV4MODEL,AUTHORING,REVIEW,LIBRARY_PART,PROJECT,CONFIG_FILE,INSTRUMENTED_ASSEMBLY,TRAY_ASSEMBLY]
@@@ END Rule Data Object

properties: 
readViewId: null
@@@ End CONSTRAINT Definition
]

 

I wanted to know how to access for each specific constraint and its ruleData() using inbuild function or API:

 

Ex.

SingleValuedConstraint
[]

StringByteLengthConstraint
[0,200]

StringLengthConstraint
[0,200]

DiscreteSetConstraint
[ECAD-HOOK-PROPAGATE-DESIGN-ATTRIBUTE-VALUES,ECAD-HOOK-RETRIEVE-DESIGN...]

 

Thanks & Regards,

KU

 

 

1 REPLY 1

Hi @KU_9877195 

You need to manipulate with the output as a string. 

First I would transfer it to several string arrays where separator is a coma with space", " or hole string ", @@@ BEGIN CONSTRAINT Definition"

You get array for each Constraint definition. 

After that you can transfer it to string array with "enter separator" you get the parameters with values where separator is ":" 

 

and so on. 

rule data contain another array with data and another separator as a just comma "." 

 

PetrH

Announcements

Top Tags