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

Community Tip - Stay updated on what is happening on the PTC Community by subscribing to PTC Community Announcements. X

JLink: Modelitem.SetName() exception

bfrandsen
6-Contributor

JLink: Modelitem.SetName() exception


Hi all

I am trying to add names to points imported from a STEP file. When I use the ModelItem.SetName(String) method I get an exception when the supplied String is set from a function, that returns a String.

SetName("NEWNAME"); //works ok.

String name ="NEW NAME";
SetName(name); //works OK

String name = method();//Method returns type String.
Setname(name); //throws an InvalidName exception

Any ideas to get around this?

TIA.
Bjarne Frandsen

(Pro/ENGINEER Wildfire 4.0 M170andWindchill 9.1M020 on Windows)

1 REPLY 1
bfrandsen
6-Contributor
(To:bfrandsen)

Hi all
Thank you for your input.
It was an illegal character in the String returned by the method and a
minor programming bug on my side.
I used these String methods
replaceAll("[']",");
replaceAll("[.]","_");
But in error I used the orginal String value each time, so the ' was
"reinserted" by the last replaceAll.
I ended up with the String "NEW_NAME" and had a hard time to discover
the extra ' in the NetBeans debugger.

Now everything is working as expected and my users got a brand new
application for christmas.

Bjarne



Bjarne Frandsen <->
22-12-2010 15:54
Please respond to
Bjarne Frandsen <->


To
<->
cc

Subject
[proecus] - JLink: Modelitem.SetName() exception







Hi all
I am trying to add names to points imported from a STEP file. When I use
the ModelItem.SetName(String) method I get an exception when the supplied
String is set from a function, that returns a String.
SetName("NEWNAME"); //works ok.
String name ="NEW NAME";
SetName(name); //works OK
String name = method();//Method returns type String.
Setname(name); //throws an InvalidName exception
Any ideas to get around this?
TIA.
Bjarne Frandsen

(Pro/ENGINEER Wildfire 4.0 M170 and Windchill 9.1 M020 on Windows)


Site Links: View post online View mailing list online Send new post
via email Unsubscribe from this mailing list Manage your subscription
Use of this email content is governed by the terms of service at:
Top Tags