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

Delete Layers with J-Link Problem

pstephens
5-Regular Member

Delete Layers with J-Link Problem

Hello J-Link Gurus,

I am having trouble getting an application to delete certain layers from a model to work.

I can add layers no problem, "ModelName.CreateLayer("_PLANES");" ,
but cannot query the model properly to list all of the existing layers and then delete the unwanted layers.

I am using Eclipse as my IDE and it throws an error when I try to get a listing of the existing layers in the model.

What I am trying to do is get the existing layer names out of the model, which is called "ModelName".

Find out if any of the layers have a certain name, if so delete these layers from the model.

A snippet of the code from the app which is not working is below:
" ModelItems listModItems = ModelName.ListItems(null);
Layers existing_layers = listModItems(ModelItemType._ITEM_LAYER);(Throws an error with this)

String listOfLayers = null;

for (int k=0; k<listmoditems.getarraysize();k++){<br/> listOfLayers = listModItems.get(k).GetName().toString();

}"

It doesn't like the "listModItems(ModelItemType._ITEM_LAYER);" part

I've tried "Layers" instead of "ModelItems" , I've actually tried a lot of different things but to no avail.

If anyone can point out where I am going wrong and provide an example of what I should be doing, I would be eternally grateful as
I cannot find any examples anywhere on the net.

Please excuse my lack of Java/J-Link skills.

TIA

Paul Stephens
Kenworth Trucks Australia



WF2 M190, Intralink 3.3 M021, Eclipse 3.3.0

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

Hi Paul
The ModelItemType._ITEM_LAYER is of type int. You should use
ModelItemType.ITEM_LAYER to get the correct type of ModelItemType.

Try this code to loop through all layer names in your model:

ModelItems listModItems = ModelName.ListItems(ModelItemType.ITEM_LAYER);
String listOfLayers = null;
for (int k = 0; k < listModItems.getarraysize(); k++)
{
        listOfLayers = listModItems.get(k).GetName();
}

Good luck,
Bjarne Frandsen



"Paul Stephens" <->
16-07-2008 23:27
Please respond to
"Paul Stephens" <->


To
-
cc

Subject
[proecus] - Delete Layers with J-Link Problem






Hello J-Link Gurus,
I am having trouble getting an application to delete certain layers from a
model to work.
I can add layers no problem, "ModelName.CreateLayer("_PLANES");" ,
but cannot query the model properly to list all of the existing layers and
then delete the unwanted layers.
I am using Eclipse as my IDE and it throws an error when I try to get a
listing of the existing layers in the model.
What I am trying to do is get the existing layer names out of the model,
which is called "ModelName".
Find out if any of the layers have a certain name, if so delete these
layers from the model.
A snippet of the code from the app which is not working is below:
"        ModelItems listModItems = ModelName.ListItems(null);
       Layers existing_layers =
listModItems(ModelItemType._ITEM_LAYER);(Throws an error with this)

       String listOfLayers = null;

       for (int k=0; k<listmoditems.getarraysize();k++){<br/>        listOfLayers = listModItems.get(k).GetName().toString();

       }"
It doesn't like the "listModItems(ModelItemType._ITEM_LAYER);" part
I've tried "Layers" instead of "ModelItems" , I've actually tried a lot of
different things but to no avail.
If anyone can point out where I am going wrong and provide an example of
what I should be doing, I would be eternally grateful as
I cannot find any examples anywhere on the net.
Please excuse my lack of Java/J-Link skills.
TIA
Paul Stephens
Kenworth Trucks Australia

WF2 M190, Intralink 3.3 M021, Eclipse 3.3.0
----------
Announcements
Attention: Creo 7.0 Customers
Please consider upgrading
End of Life announcement here.