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

Community Tip - Learn all about the Community Ranking System, a fun gamification element of the PTC Community. X

rename a group in a JLink program?

lylebeidler
1-Visitor

rename a group in a JLink program?

Have any of you JLink gurus renamed a group in your JLink code?

I found a SetName command for the ModelItem interface, and tried to cast the
featuregroup to a ModelItem, thus:



ModelItem thisGroupItem = (ModelItem)thisGroup;

thisGroupItem.SetName("TIE_DOWNS");



but the cast command throws an exception.

Any other ideas?

Thanks

--



Lyle Beidler
MGS Inc
178 Muddy Creek Church Rd
Denver PA 17517
717-336-7528
Fax 717-336-0514
<">mailto:-> -
<">http://www.mgsincorporated.com>
2 REPLIES 2


> I found a SetName command for the ModelItem interface, and tried to cast the
> featuregroup to a ModelItem, ... but the cast command throws an exception.

You cannot cast a FeatureGroup to ModelItem, because it is not derived from
that class. To make matters worse, the FeatureGroup class seems not to provide
a SetName() method, according to the docs.



Marc
--
Marc Mettes
-
Visit My CAD/PDM AutomationBlog
Or, Subscribe to My CAD/PDM Automation Blog by Email





I am not sure, whether this could solve your problem or not, as I have not
tested it.

In Wildfire each group has an additional GroupLeader feature, which can be
retrieved with GetGroupLeader() and renamed. This might be the way to the
group name shown in the modeltree. Give it a try.

Another option could be to retrieve the features of the group, ungroup and
recreate the group with the desired name. I have not found any ungroup
method, but again maybe just deleting the GroupLeader feature will do the
job.

Let me know if any of these ideas was useful.
Bjarne



Marc Mettes <->
14-12-2009 18:48
Please respond to
Marc Mettes <->


To
-
cc

Subject
[proecus] - RE: rename a group in a JLink program?







> I found a SetName command for the ModelItem interface, and tried to cast
the
> featuregroup to a ModelItem, ... but the cast command throws an
exception.
You cannot cast a FeatureGroup to ModelItem, because it is not derived
from
that class. To make matters worse, the FeatureGroup class seems not to
provide
a SetName() method, according to the docs.


Marc
--
Marc Mettes
-
Visit My CAD/PDM Automation Blog
Or, Subscribe to My CAD/PDM Automation Blog by Email





-----End Original Message-----
Announcements


Top Tags