Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

  • Congratulations IDS on being selected by the Eng-Tips community for having the most helpful posts in the forums last week. Way to Go!

Work Layer Changing

Status
Not open for further replies.

ozo126

Mechanical
Oct 2, 2007
5
Hello all,

I have looked through the forum but cant see any threads with my issue.

I am working on NX4. My Company always have their custom border inserted on a sheet inside the model file so the model and drafting are all one file.

I have wrote a macro to add the border and standard text.
I have run into some probelms with the border in relation to
layers:

...My Border and text in my macro is on layers 100 and 102 respectively.
...I always change my work layer to layer 100 before I insert my macro.
...When I insert my macro into a blank drawing ie- No sketches, No blocks, No additional datum planes my work layer does not change.
...When I insert my macro into a drawing with a part the work layer changes to layer 60.
...Layer 60 is the layer were I insert new datum planes.

Here comes the BIG probelm:

When I insert a large or really complicated part or assembly my border and text changes to a random layer.
Although it doesnt seem like a big deal as you can change back to the original layers theres no reason why it shouldnt work and its alot of hassle and wasted time when your drafting alot.

Thanks for any advice in advance,

Andrew Owens
Development Engineer
 
Replies continue below

Recommended for you

Is the border in its own file and then the macro imports that file into your working file? Are different sized borders each in their own file or are they combined into 1 file? I ask because when you import a file you have the option to import the entities onto the work layer or the original layer (the layer the entities are on in the file you are importing from).

Does the macro change the work layer to the desired layer before importing and/or adding entiites? (if not, it should)

Is the macro starting from a known state? Strange things may happen if the macro is not started in the same application it was recorded in - for instance if you record a macro in the modeling application you may get some unexpected results if you later try to run the macro in the drafting application. You may have to do a 'gateway reset' as the first action in the macro to make sure it starts in the correct context. When you record the macro switch to the gateway application as the first action, then switch to the desired application and run your commands. The gateway reset will make sure the macro is run in the intended way.
 
Andrew,

Honestly what you describe as your BIG problem sounds like you may have found something that you need to refer to PLMS for a second look, (dare I say bug). Seriously if there really is random behavior then in computer terms it can't be good. You may be helping others by referring it, and for yourself well there may be a patch already out there if it is a known problem. Without your files and macros I doubt that anyone else could duplicate the problem. So if I were you I'd go back to a file where it happened using the macro and attempt to re-create the same results by stepping through the same procedure without using your macro to see if that is where the problem lies.

Because you're working in a drawing I wonder if it isn't something to do with "Visible in View". So if you add a could of steps in your macro that set the Visible in View layers to global for the drawing sheet it may help.

You may also want to compare how a journal file works as opposed to a macro. You may have more luck.

All things being equal I might solve the problem by approaching the task differently. I understand what you're trying to do and that you may have some reason that I hope you'll share if you disagree with me. On the other hand there was a time when we used to work with drawing borders in this way, but now we use master model concept and drafting templates and we've never looked back. We have written extensive descriptions of how it is done in this forum alone. If you think that this approach may suit you then I can highly recommend it to you.


Last but not least please write back and let us know how you get on I'm keen to know the result of our attempts to help.

Regards

Hudson
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor