Continue to Site

Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

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

Launch a .bat file inside a macro 1

Status
Not open for further replies.

PSI-CAD

Computer
Feb 13, 2009
997
Hi,
Is it possible with NX5 to launch a dos file .bat inside a macro playback ?
It's very easy with Ideas
Thanks in advance
Regards
Didier
 
Replies continue below

Recommended for you

Firstly I can say that it is possible, technically. There might be a better more efficient way to do it though. If you have your macro run a grip program with an "XSPAWN" call to the batch file that should work. You could also run a different kind of program such as an executable rather than a batch job using the same technique, or you could have the macro run a UG Open program other than grip that is capable of doing the same thing.

Macro's however are limited to interacting with NX commands. One suspects that you ought to be able to do it from a journal by including the extra programming directly. If so it may be found by searching the forum as there's a slight chance the question has been asked before. Otherwise like you I'm keen to have some enterprising user post the code.


Best Regards

Hudson

www.jamb.com.au

Nil Desperandum illegitimi non carborundum
 
hi
find herewith more information about my request:
l need to create a note on drawing with complete path and of the displayed part
l found the following solution
1: execute a macro that create nx log file
2: execute a bat file that modify nxlogfile with only the following line
(string) path="c:\...\partname.prt"
3: execute a macro that import nxlogfile.exp in expressions

so, i have to launch step 2 from step 1, then launch step 3

actually, i have a toolbar with 3 icons

i am not an expert with grip or vb to do this

thanks in advance
didier
 
OK, here is a VERY simple GRIP program which should give you what you're looking for:

This program extracts the complete file specification
path for the current part file and writes this information
into a Part Attribute.

This program must be run while a Part file is Open.


All you need to do now is create your note referencing the value of the Part Attribute.

As before, after downloading, edit the file extension from .zipper to .zip before extracting the content.


John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Is it possible to pull attributes of all chldren in an assembly this way also?
 
cyoung45,

Yes it is possible but I'm glad you're offering to program
it for us because it certainly isn't necessarily easy.

You'd need to consider what the attributes you wish to duplicate are or whether you interrogate whatever attributes you can find in each components and simple assign them some sort of duplicate instance in the top assembly. Then you need to know how many components there are and whether you wish to go down one level or into all the sub-assemblies in the tree.

Having considered all those and other aspects of what you require such a program to achieve you then need to address how you're going to use and maintain that data and why other existing tools might do a better job if you adapted them to a similar purpose. Why? Because most of the time what you want to do talks about the same kinds of things that parts lists already do better in most cases.

Some solutions may make limited use of GRIP, others will require anything from macros and journals through to advanced c programming skills. Unfortunately for most of us you have to want a specific customisation pretty badly before you're willing to expend time and resources in the creation of such code.

Notably we have recently posted at length about how to use annotations with relationships to attributes or expressions you'll find several recent posts by searching. They address functionality found under the annotation editor and using tables. When you have read up a bit more and are perhaps willing to discuss your specific requirements we might be able to offer a couple of pointers. I'd urge you then to start your own thread on it in that vein.

Best Regards

Hudson

www.jamb.com.au

Nil Desperandum illegitimi non carborundum
 
OK, attached is a GRIP program which will cycle through an open Assembly and generate a report listing all of the attributes assigned to each Component in the assembly.

This program reads and then creates a report (displayed on the current listing device) of all Attributes assigned to the Components of an Assembly.

The size of the Assembly is limited to 1,000 Components, with no more than 100 Attributes assigned to each Component.

Note that an Assembly needs to be open when you launch this program.


Note that the largest assembly that I've tested this on was only 159 components. Also note that the program does not account for multiple occurrences of the same Component, listing them as if they were individual Components. This could be modified to only report duplicates once, but it would not be trivial.

As before, edit the file extension from .zipper to .zip before extracting the files.

Anyway, I hope this helps.

Have fun.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Hi John

The Product 'Evangelist' or Unigraphics Gourou, with a lot of different UGS business card

Thanks a lot for your program

Is it possible to modify the Component_Attributes.grs to create in the same time the attribut file_spec for the complete part in assembly ?

Regards

Didier
 
OK, try this and see if it gives you what you're looking for.

As before, edit the file extension before attempting to extract the contents.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Thanks, John. I'd like to ask another question. Is it possible to "source" a grip program from postbuilder?
 
I have no idea. Never had a need to even think about doing that. Perhaps some CAM oldtimer might have considered it at one time.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Hi John,

The new component_attributes programm report the file specification but doesn't create it !!

Regards

Didier
 
I'm sorry, I misunderstood.

But that begs the question, if for example I have say 300 or 400 components, where is that you would like me to create this 'attribute' with the file spec for each Component, or are you only interested in the file spec for the Assembly file itself?

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Hi John,

I am interested in the file spec for each component.



Regards

Didier
 
But where do you want me to put the Part Attributes, in the top-level assembly or inside each individual component?

I ask this since so far the only file which I actually need set as the Work Part is the top-level assembly. If I'm going to write attributes to the individual component files, they will need to be set as the Work Part as I cycle the assembly, which I suspect will add considerable time the running of the program. And then there is the issue of what do we do with 'Read Only' parts? I suspect that the only way that I would be able to detect whether a part is 'Read Only' or not will be to actually attempt to save it and trap the error that will be generated when the save fails, but I may not be able to recognize this particular failure from any of the other possible failures which might occur. And in the case of family table parts, such as fasteners, they are BY DEFINITION permanently 'READ ONLY', and cannot be set as NOT 'Read Only' by the user, no matter what his/her level of system privileges might be.

John R. Baker, P.E.
Product 'Evangelist'
Product Design Solutions
Siemens PLM Software Inc.
Cypress, CA

To an Engineer, the glass is twice as big as it needs to be.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor