×
INTELLIGENT WORK FORUMS
FOR ENGINEERING PROFESSIONALS

Log In

Come Join Us!

Are you an
Engineering professional?
Join Eng-Tips Forums!
  • Talk With Other Members
  • Be Notified Of Responses
    To Your Posts
  • Keyword Search
  • One-Click Access To Your
    Favorite Forums
  • Automated Signatures
    On Your Posts
  • Best Of All, It's Free!
  • Students Click Here

*Eng-Tips's functionality depends on members receiving e-mail. By joining you are opting in to receive e-mail.

Posting Guidelines

Promoting, selling, recruiting, coursework and thesis posting is forbidden.

Students Click Here

Jobs

I run this code, but got some error

I run this code, but got some error

I run this code, but got some error

(OP)
nx 8.5 + office 2013 pro 32bit


as you mentioned ms access 32bit cannot talk to NX 8.5, so i want to try excel and i found a post where you posted some code to write excel file using journal:

http://www.eng-tips.com/viewthread.cfm?qid=311938

after i run the code, the following error occurs:
server busy
the action cannot be completed because the other program is busy. choose "Switch" to activate the busy program and connect the problem........

what happen??

also, in that post, you said that:
you can access Excel as per the following code, but you lose the 'autocomplete' feature of visual studio. If you go this route, you may want to keep an instance of Excel running so you can reference the object model.

how do you keep an instance of Excel running?

thank you
 

RE: I run this code, but got some error

The original code was tested on NX 7.5 (64 bit) and Excel 2010 (32 bit). I tested this morning and it also runs on NX 8.5 (64 bit) and Excel 2010 (32 bit). I'd guess the message you see has something to do with Excel 2013, but I cannot test that...

I should have been more clear with my "keep an instace of Excel running" comment. By that I simply meant that you may want to keep Excel open while programming your journal. This way you can record a macro in Excel and quickly see what objects, properties, and methods you can use to accomplish the task. Also, the Excel code may be interspersed with Excel constants such as Direction.xlUp; most of these are enumerations in Excel. Using the Excel object browser (easy to get to if you have Excel open), you can find the numerical value of the constant and enter it in your journal code for the same effect.

www.nxjournaling.com

RE: I run this code, but got some error

(OP)
thank you cowski,

since i am now trying to use to loop through notes on drawing. and you know that notes are scattered everywhere on drawin.

what will be the best way to identify note so that they can match with "something" in Excel and then if matched, the content of note can be updated.

when i do the tolerance looping through task, i use AppendedTest to identify each dimension, but now looks like note is headache....

RE: I run this code, but got some error

(OP)
i think i found the solution

i write something like this

For Each note As Note In displayPart.Notes

by writting:
note.tostring

it will return the ID of the note like this: Note 98483

RE: I run this code, but got some error

Try comparing
note.ToString
to
note.Tag.ToString

If the numbers returned are the same, then the .ToString method is returning the tag number of the note. The Tag property is NOT guaranteed to remain the same from session to session (i.e. the tag number you see today may not be the same tag number you see when you close and reopen the part).

www.nxjournaling.com

RE: I run this code, but got some error

(OP)
YOU are correct, neight of them will retain the same value each time i close and re-open the drawing file.....

is there any other alternative solution?

RE: I run this code, but got some error

(OP)
yes, found a way

right click on notes, property, then in the General tab, give a name in the Name textbox.

in the code write something like

if note.getname() = "fsdfsade"

then...

RE: I run this code, but got some error

The usual method is to assign a custom attribute or (as you have already found) a custom name to the object of interest.

www.nxjournaling.com

RE: I run this code, but got some error

(OP)
this method was pointed by John Baker when I asked how to suppress feature

so, what's the benefit for using attribute? will there be a dramatic code change?

I saw lots of method and property under note such as note.getattributeType, AttributeInformation, etc, etc

Red Flag This Post

Please let us know here why this post is inappropriate. Reasons such as off-topic, duplicates, flames, illegal, vulgar, or students posting their homework.

Red Flag Submitted

Thank you for helping keep Eng-Tips Forums free from inappropriate posts.
The Eng-Tips staff will check this out and take appropriate action.

Reply To This Thread

Posting in the Eng-Tips forums is a member-only feature.

Click Here to join Eng-Tips and talk with other members!


Resources