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

Community Tip - You can Bookmark boards, posts or articles that you'd like to access again easily! X

Create Rules for layers using Pro/toolkit

joseph_isreavel
1-Newbie

Create Rules for layers using Pro/toolkit

Hi,

Anybody know that how to create rules for layers, using Pro/Toolkit. Please share your ideas if you know how.

Thanks in advance,

BestRegards,

Joseph


This thread is inactive and closed by the PTC Community Management Team. If you would like to provide a reply and re-open this thread, please notify the moderator and reference the thread. You may also use "Start a topic" button to ask a new question. Please be sure to include what version of the PTC product you are using so another community member knowledgeable about your version may be able to assist.
13 REPLIES 13

Hi all,

Joseph,

Unfortunatelythere isn't Pro/Toolkit API for rule based layers. ( we were asking for it for years...)

-Trail file subscript or macro call from Pro/Toolkit is one ofthe options.

-using Pro/E functionality build around "default_layer_model" config option is another one.Works only with new features or geomitems.

- using ProLayerDefLayerSet and ProLayerDefLayerGet functions. Rule based layer functionality could be faked to some extentby using this method.

HIH.

Feliks.

Hi Feliks,

Thank you very much, that is very useful information.

Regards,

Joseph

Thank u Feliks.

I searched for the same Term. I heard u can get layers out of other models and "import" / copy it to your model. But I don't find the right way to do it, now. But I'll try to have a look for ur last Option.

Bye,

Eike


Hi all,

Eike,

Take a look at the 'Layer Status File' in Pro/E help - it describes how to use text files to build layering scheme...

default_layer_model has quite a number of related articles in 'Knowledge base'...

default_layer_model is a very powerfull option, it will assign layer rules to newly created layers sharing same names with the layers deifned in layer template model.Thenew layers in a model could be createdusing 'LayerStatus File' of Pro/Toolkit or J-ling or GUI. A layer with ruleswill be created automatically when a matching entity would be created in a model (for example, if template layer model has a rule based layer for datum planes then that layer will be automatically created in anactive model when a new datum plane was made). The new layer will not be associative and it will be dependent.

Thedrawbacks are: layer template model has to be in session...otherwise nothing would work, andthere is no API to make layer properties associative/non-associative and dependent/independent.Change of layer properties had to be handled by trail file script or macro.

I would personally use thistechnique when dealing with the mass editing/updating of old models to new layering standards or when starter templates to be made. Algorithm is simplistic:

-set up defaul_layer_model via ProConfigoptSet

-loop through models to be processed

-make/delete layers in model via ProLayerCreate/ProLayerDelete

-remove config option

-loop through models to be processed, again - run ProMacro... to make layer properties associative and independent - after this the layer will handle existing entities/features.

HIH.

Feliks.

In Reply to Eike Petersen:

Thank u Feliks.

I searched for the same Term. I heard u can get layers out of other models and "import" / copy it to your model. But I don't find the right way to do it, now. But I'll try to have a look for ur last Option.

Bye,

Eike


I am not creating the model new, model already available. In the model, I would like to create rule based layer with rules like


1. datum with Name = XXX is to be added to the layer.---- (Name = XXX) LookBy: datum plane.


2. datum which is not available in other layer has to be added to current layer ----(Type = Datum Axis) and (! In layer "layer2")


Is this possible, with the method you suggest.



Thanks,


Joseph

Hello all,


Joseph,


Questions:


-are rules to be associative and independent?


- are rules to be used for new features/geometry, existing features/geometry or both?


-are rules to be used for features or geomitems?


-are rules to berequired to perform'real-time' evaluation or evaluation could be postponed until some agreed uponevent?


FV.

In Reply to Isreavel Joseph:



I am not creating the model new, model already available. In the model, I would like to create rule based layer with rules like


1. datum with Name = XXX is to be added to the layer.---- (Name = XXX) LookBy: datum plane.


2. datum which is not available in other layer has to be added to current layer ----(Type = Datum Axis) and (! In layer "layer2")


Is this possible, with the method you suggest.



Thanks,


Joseph


Hi Feliks,


Here are the answers,


1. Yes rules are associative and independant.


2. Rules are for both new featues and existing features.


3. Rules used for only features.


4. evaluation can be postponed, because other sequence of events occurse after rule creation.



Thanks,


Joseph

Hi,


How to use 'LayerStatus File' option through Pro/toolkit.



Thanks,


Joseph

Hello all,


Joseph,


IMHOyou don't need rule based layers. I would use ProNotify to capture model post regenerate and model pre save events and would use ProSolidFeatVisit to run a visit function to set feature layers. You would get better regeneration performance comparing to rule based layer approach and you would gain flexibilityif you ever needed to change companylayering standards.


HIH.


Feliks.



In Reply to Isreavel Joseph:



Hi Feliks,


Here are the answers,


1. Yes rules are associative and independant.


2. Rules are for both new featues and existing features.


3. Rules used for only features.


4. evaluation can be postponed, because other sequence of events occurse after rule creation.



Thanks,


Joseph


Feliks,


I have been following this thread as I, too, need to update parts with layers copied from another model (start part) and wish to maintain the layer rules. It is not working as I expected.


I am trying to use the ProConfigoptSet API as you have discussed and have found little information in the ProToolkit help documentation. I have the following line of code


ProError err = ProConfigoptSet(L"defaul_layer_model", L"MyInsessionPart.prt");


in which I have a part in session but not displayed (referred to here as MyInsessionPart.prt). This causes my ProEngineer to crash. I have tried this with and without including the ".prt" in the part name. Any suggestions would be greatly appreciated. At this time it is only test code, so I manually loaded the start part, then closed it such that it was in session, prior to running the test algorithm.



Regards,


Sharon B.

Dear Sharon,


I have the same problem first. Problem everytimes come up when I wan't to get the Layers from the .prt on a .asm. So u need a model for .asm and a model for .prt both named similar. Then U can get the model name with or without the ending inside the parameter.


When you get the model inside the option u can create new layers with will automaticly get the specified rules from the template model. (created layer must have same name as copyed layer) than switch the layer options like Feliks says and everything works out perfect.


You can also get full path to part inside the config option. Sometimes it could help.


status = ProConfigoptSet( L"default_layer_model", L"c:/testpath/comeone/MyInsessionPart.prt" );

I've programmed the change Options in J-Link and Toolkit, both times it worked perfectly.


Thanks for ur help Feliks.


Regards,


Eike

Hi all,


Sharon,


You should not use file extension while setting default_layer_model config option.


For plain Pro/E functionality, the procedure would be to create apart and an assembly file with the same name, and store it somewhere accessibleto Pro/E session either via search_path or byproviding afully qualified path.The layer part/assemblyshouldbe empty (no datums and so on). The config.pro example ( UNIX directory delimiters):


default_layer_model c:/standards/layer/layer_template


There must exist layer_template.prt.1 and layer_template.asm.1 (.1 is an example) in c:\standards\layer directory.


Where Toolkit concerned is when default_layer_model optionto be set dynamically via ProConfigoptSet. Based on the maintenance release of Pro/E the option may or may not take effect instantly especially if path to a layertemplate modelwas present. So, for times when Pro/E maintenance releasesstop working I wouldcopy (backup)layer template model(s) into the current working directory and thencall


ProConfigoptSet(L"default_layer_model", L"layer_template");


Again, I cannotpinpoint a problem tothe specific cut of Pro/E, but sometime ProConfigoptSet should be followed by the call ProMdlRetrieve( L"layer_template"...) and sometimes it wasworking without layer_template model(s) called into session. What deffinitelyis not working for WF5 is to call template layer model into session and then call ProConfigoptSet.The disk data has to be accessible to Pro/E.


HIH.


FV.

In Reply to Sharon Barber:



Feliks,


I have been following this thread as I, too, need to update parts with layers copied from another model (start part) and wish to maintain the layer rules. It is not working as I expected.


I am trying to use the ProConfigoptSet API as you have discussed and have found little information in the ProToolkit help documentation. I have the following line of code


ProError err = ProConfigoptSet(L"defaul_layer_model", L"MyInsessionPart.prt");


in which I have a part in session but not displayed (referred to here as MyInsessionPart.prt). This causes my ProEngineer to crash. I have tried this with and without including the ".prt" in the part name. Any suggestions would be greatly appreciated. At this time it is only test code, so I manually loaded the start part, then closed it such that it was in session, prior to running the test algorithm.



Regards,


Sharon B.


Feliks and Eike,


Sorry for the delayed response. Since I'm prototyping this code in anticipation of future development, I have not been able to work on it continuously. Just wanted to thank both of you though. I did get my initial prototype code to work so I should be able to follow through with development to copy layers from one part to another without losing the layer rules.


Again, thank you both so much for the help.



Regards,


Sharon Barber

Top Tags