User-Defined Attributes
sd-attach-item-attribute
sd-add-item-attribute-values
sd-del-item-attribute-values
sd-detach-item-attribute
sd-inq-item-attributes
sd-inq-item-attribute
sd-mod-item-attribute
SD-ATTACH-ITEM-ATTRIBUTE [function]
(sd-attach-item-attribute item name
:attachment attachment
:on-copy on-copy
:on-merge on-merge
:on-split on-split
:on-xform on-xform
:on-sysid-change on-sysid-change
:filing filing
:values value-list
:set-modified set-modified
:check-read-only check-read-only)
- Description:
- Attaches an attribute with name to item. Defines the
attribute's behavior and assigns initial values to it.
- Parameters:
-
- item {SEL_ITEM}
- any object or element that can be described by a SEL_ITEM (except
user-defined features)
-
Note: Suitable items are:
- Topological elements (Face, Edge or Vertex),
- Objects (Part, Assemlby, ...)
- 3D_Annotation
- It's not recommended to use items of any other type.
- name {STRING}
- Identifies the attribute in the context of the item. If the
item already has an attribute of this name attached, the
old attribute is detached.
- :attachment {KEYWORD [:instance]}
-
when item is an object, determines whether the attribute is
attached to the instance or the contents
- :instance - attribute is attached to the instance
- :contents - attribute is attached to the contents
- :on-copy {KEYWORD [:copy]} - defines attribute behavior
when item is copied
-
- :copy - a copy of the attribute is also attached to the
copy of item
- :maintain - the original item only maintains its
attribute unchanged
- :on-merge {KEYWORD [:maintain]}
-
defines attribute behavior when item is merged with another
item
- :maintain - The attribute is attached to the surviving
item if it does not already have an attribute of the same
name with different values (either different keys or
values). In this case, both attributes are detached.
- :detach - attribute is detached when item is
merged
- :on-split {KEYWORD [:copy]} - defines attribute behavior
when item is split
-
- :copy - a copy of the attribute is also attached to the
new item resulting from the split
- :detach - attribute is detached when item is
split
- :on-xform {KEYWORD [:maintain]} - defines attribute
behavior when item is transformed
-
- :maintain - item maintains the attribute
unchanged
- :detach - attribute is detached from item
- :on-sysid-change {KEYWORD [:maintain]} - defines attribute
behavior when item is assigned a new SysID (unique
identifier)
-
- :maintain - item maintains the attribute
unchanged
- :detach - attribute is detached from item
- :filing {KEYWORD or LIST OF KEYWORDS [:sd-file]}
-
specifies the output files that will include the attribute. The
following keywords (and combinations of those as a list) are valid:
- :sd-file - the attribute is included in standard Creo
Elements/Direct Modeling output files
- :mi-file - the attribute is included in MI files
created for Creo Elements/Direct Modeling layouts (info text)
- :none - the attribute is not included in any output
files
- :values {PROPERTY LIST [nil]}
-
User-defined values for the attribute are passed as a property list.
Each key of the property list can be either a keyword or a string
(case-sensitive!). These keys are used to organize multiple values
within the attribute. The reserved behavior keywords used as
parameters to this function are not allowed within the property
list. The value associated with each key can be any LISP FORM.
Note: Don't try to assign the definitions of compiled
functions as attribute values (ex: #'print). Instead, assign the
symbol naming the compiled function (ex: 'print). This restriction
does not apply to uncompiled functions or lambda expressions.
- :set-modified {BOOLEAN} [t]}
-
- t - the modified flag of the item will be set.
- nil - the modified flag of the item will not be
set.
- :check-read-only {BOOLEAN} [t]}
-
- t - an error message is generated if the item is
read-only.
- nil - the function applies even if the item is
read-only.
- Return Value:
-
- t - attachment was succesful
- nil - an error occured
- Example:
-
(sd-attach-item-attribute my-part "foo-attribute"
:attachment :contents
:on-copy :maintain
:on-merge :detach
:on-split :detach
:on-xform :detach
:on-sysid-change :maintain
:filing '(:sd-file :mi-file)
:values '(:foo-key "some string value"
"bar-key" '(100.0 300.5 234.7)))
SD-ADD-ITEM-ATTRIBUTE-VALUES [function]
(sd-add-item-attribute-values item name values
:attachment attachment
:set-modified set-modified
:check-read-only check-read-only)
- Description:
- Add new values to an attribute attached to an item.
- Parameters:
-
- item {SEL_ITEM} - the item the attribute is attached
to
- name {STRING} - the attribute of the item to add values
to
- values {PROPERTY LIST}
- New user-defined values for the attribute are passed as a property
list. Each key of the property list can be either a keyword or a
string (case-sensitive!). The reserved behavior keywords used as
parameters to this function are not allowed within the property list.
The value associated with each key can be any LISP FORM.
- :attachment {KEYWORD [:instance]}
-
when item is an object, determines whether to add values to
an attribute attached to the instance or the contents
- :instance - add to the instance
- :contents - add to the contents
- :set-modified {BOOLEAN} [t]}
-
- t - the modified flag of the item will be set.
- nil - the modified flag of the item will not be
set.
- :check-read-only {BOOLEAN} [t]}
-
- t - an error message is generated if the item is
read-only.
- nil - the function applies even if the item is
read-only.
- Return Value:
-
- t - new values were added.
- nil - an error occurred.
- Example:
-
(sd-add-item-attribute-values my-part "foo-attribute" '(:new-key 42))
SD-DEL-ITEM-ATTRIBUTE-VALUES [function]
(sd-del-item-attribute-values item name values
:attachment attachment
:set-modified set-modified
:check-read-only check-read-only)
- Description:
- Delete values from an attribute attached to an item.
- Parameters:
-
- item {SEL_ITEM} - the item the attribute is attached
to
- name {STRING} - the attribute of the item to delete values
from
- values {KEYWORD, STRING, or LIST}
- Either a single key or a list of keys specifying existing values
of the attribute to be deleted is passed.
Note: A keyword key needs a keyword as key and a string key needs a
string with the exact same spelling including upper- and
lower-case.
- :attachment {KEYWORD [:instance]}
-
when item is an object, determines whether to delete values
of an attribute attached to the instance or the contents
- :instance - delete from the instance
- :contents - delete from the contents
- :set-modified {BOOLEAN} [t]}
-
- t - the modified flag of the item will be set.
- nil - the modified flag of the item will not be
set.
- :check-read-only {BOOLEAN} [t]}
-
- t - an error message is generated if the item is
read-only.
- nil - the function applies even if the item is
read-only.
- Return Value:
-
- t - always
- Example:
-
(sd-del-item-attribute-values my-part "foo-attribute" :some-key)
(sd-del-item-attribute-values my-part "foo-attribute" '("key1" "key2"))
SD-DETACH-ITEM-ATTRIBUTE [function]
(sd-detach-item-attribute item name
:attachment attachment
:set-modified set-modified
:check-read-only check-read-only)
- Description:
- Detaches attribute with name from item.
- Parameters:
-
- item {SEL_ITEM} - the item from which to detach the
attribute
- name {STRING} - the string identifying the attribute
- :attachment {KEYWORD [:instance]}
-
when item is an object, determines whether the attribute is
detached from the instance or the contents
- :instance - attribute is detached from the
instance
- :contents - attribute is detached from the
contents
- :set-modified {BOOLEAN} [t]}
-
- t - the modified flag of the item will be set.
- nil - the modified flag of the item will not be
set.
- :check-read-only {BOOLEAN} [t]}
-
- t - an error message is generated if the item is
read-only.
- nil - the function applies even if the item is
read-only.
- Return Value:
-
- t - detachment was succesful
- nil - an error occured
SD-INQ-ITEM-ATTRIBUTES [function]
(sd-inq-item-attributes item :attachment attachment)
- Description:
- Returns a list of all attributes attached to item.
- Parameters:
-
- item {SEL_ITEM} - the item the attributes are attached
to
- :attachment {KEYWORD [:instance]}
-
when item is an object, determines whether to inquire the
instance or the contents
- :instance - inquire the instance
- :contents - inquire the contents
- Return Value:
-
- attributes {LIST} - list of name strings identifying all
attributes attached to item
- nil - item does not have any attributes or an error
occured.
- Example:
-
Test to see if my-part has "some-attribute":
(member "some-attribute" (sd-inq-item-attributes my-part) :test #'string=)
SD-INQ-ITEM-ATTRIBUTE [function]
(sd-inq-item-attribute item name specification :attachment attachment)
- Description:
- Returns current behaviors and values for an attribute of an
item.
- Parameters:
-
- item {SEL_ITEM} - the item the attribute is attached
to
- name {STRING} - the attribute of the item to inquire
- specification {KEYWORD, STRING, or LIST}
-
specifies the behaviors and/or values to inquire
- :all - return all behaviors and values as a single
property list
- :behaviors - return all behaviors as a property
list
- :values - return all values as a property list
- key - return the value associated with the
specified behavior or value key
- list of keys - return the values associated with
the specified behavior and/or value keys as a property list
Note: Keys need to be the same as in sd-attach-item-attribute especially
string keys need the exact same spelling including upper- and
lower-case. Database attributes use usually string keys and thus you
need to access these attributes with the exact same string key.
- :attachment {KEYWORD [:instance]}
-
when item is an object, determines whether to inquire the
instance or the contents
- :instance - inquire the instance
- :contents - inquire the contents
- Return Value:
-
- values {LISP FORM or PROPERTY LIST}
- a single value associated with a key or a property list of keys
and their values.
- nil - either the item does not have the attribute or the
specified keys, or an error occured.
- Example:
-
(setq vals (sd-inq-item-attribute my-part "foo-attribute" :values))
=> (:foo-key "some string value" "bar-key" '(100.0 300.5 234.7))
(getf vals :foo-key) => "some string value"
(sd-inq-item-attribute my-part "foo-attribute" :foo-key)
=> "some string value"
(sd-inq-item-attribute my-part "foo-attribute" '(:foo-key :on-copy))
=> (:foo-key "some string value" :on-copy :maintain)
SD-MOD-ITEM-ATTRIBUTE [function]
(sd-mod-item-attribute item name
:attachment attachment
:on-copy on-copy
:on-merge on-merge
:on-split on-split
:on-xform on-xform
:on-sysid-change on-sysid-change
:filing filing
:values value-list
:set-modified set-modified
:check-read-only check-read-only)
- Description:
- Modifies behaviors and/or values of an existing attribute attached to
an item.
- Parameters:
-
- item {SEL_ITEM} - the item the attribute is attached
to
- name {STRING} - the attribute of the item to modify
- :attachment {KEYWORD [:instance]}
-
when item is an object, determines whether an attribute
attached to the instance or the contents is modified
- :instance - attribute attached to the instance is
modified
- :contents - attribute attached to the contents is
modified
- :on-copy {KEYWORD or nil [nil]} - defines attribute
behavior when item is copied
-
- nil - :on-copy behavior is not changed
- :copy - a copy of the attribute is also attached to the
copy of item
- :maintain - the original item only maintains its
attribute unchanged
- :on-merge {KEYWORD or nil [nil]}
-
defines attribute behavior when item is merged with another
item
- nil - :on-merge behavior is not changed
- :maintain - The attribute is attached to the surviving
item if it does not already have an attribute of the same
name with different values (either different keys or
values). In this case, both attributes are detached.
- :detach - attribute is detached when item is
merged
- :on-split {KEYWORD or nil [nil]} - defines attribute
behavior when item is split
-
- nil - :on-split behavior is not changed
- :copy - a copy of the attribute is also attached to the
new item resulting from the split
- :detach - attribute is detached when item is
split
- :on-xform {KEYWORD or nil [nil]} - defines attribute
behavior when item is transformed
-
- nil - :on-xform behavior is not changed
- :maintain - item maintains the attribute
unchanged
- :detach - attribute is detached from item
- :on-sysid-change {KEYWORD or nil [nil]} - defines attribute
behavior when item is assigned a new SysID (unique
identifier)
-
- nil - :on-sysid-change behavior is not changed
- :maintain - item maintains the attribute
unchanged
- :detach - attribute is detached from item
- :filing {KEYWORD, LIST OF KEYWORDS or nil [nil]}
-
specifies the output files that will include the attribute
- nil - :filing behavior is not changed
- :sd-file - the attribute is included in standard Creo
Elements/Direct Modeling output files
- :mi-file - the attribute is included in MI files
created for Creo Elements/Direct Modeling layouts
- :none - the attribute is not included in any output
files
- :values {PROPERTY LIST or nil [nil]}
- Existing user-defined keys and their new values are passed as a
property list. The values of keys in the list will be modified. Keys
not in the list will be left unchanged. The reserved behavior keywords
used as parameters to this function are not allowed within the
property list. The value associated with each key can be any LISP
FORM. If nil is passed, no values will be changed.
- :set-modified {BOOLEAN} [t]}
-
- t - the modified flag of the item will be set.
- nil - the modified flag of the item will not be
set.
- :check-read-only {BOOLEAN} [t]}
-
- t - an error message is generated if the item is
read-only.
- nil - the function applies even if the item is
read-only.
- Return Value:
-
- t - specified attribute behaviors and/or values were
modified
- nil - an error occured
- Example:
-
(sd-mod-item-attribute my-part "foo-attribute"
:attachment :contents
:on-copy :copy
:values '(:foo-key "some new string value"))
© 2024 Parametric
Technology GmbH
(a subsidiary of PTC Inc.), All Rights Reserved |