Print user name on idw

Print user name on idw

Anonymous
Not applicable
528 Views
11 Replies
Message 1 of 12

Print user name on idw

Anonymous
Not applicable
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
529 Views
11 Replies
Replies (11)
Message 2 of 12

Anonymous
Not applicable
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
Message 3 of 12

Anonymous
Not applicable
I mean the current user who opens my .idw and prints it

"Joe Sutphin" wrote in message
news:5186369@discussion.autodesk.com...
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
Message 4 of 12

Anonymous
Not applicable
'Windows API declarations
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetNetworkUserName() As String
Dim USERNAME As String
'Create a buffer
USERNAME = String(100, Chr$(0))
'Get the username
GetUserName USERNAME, 100
'strip the rest of the buffer
GetNetworkUserName = Left(USERNAME, InStr(USERNAME, Chr(0)) - 1)
End Function


"Chris (IV11 Pro. SPxx)" wrote in message
news:5186488@discussion.autodesk.com...
I mean the current user who opens my .idw and prints it

"Joe Sutphin" wrote in message
news:5186369@discussion.autodesk.com...
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
Message 5 of 12

Anonymous
Not applicable
Hi Joe,
Not sure to understand your code completely.
To insert this code into the document, the user name will be printed each
time the dwg is sent to the printer?
if so, how???
Thx

"Joe Sutphin" wrote in message
news:5187020@discussion.autodesk.com...
'Windows API declarations
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetNetworkUserName() As String
Dim USERNAME As String
'Create a buffer
USERNAME = String(100, Chr$(0))
'Get the username
GetUserName USERNAME, 100
'strip the rest of the buffer
GetNetworkUserName = Left(USERNAME, InStr(USERNAME, Chr(0)) - 1)
End Function


"Chris (IV11 Pro. SPxx)" wrote in message
news:5186488@discussion.autodesk.com...
I mean the current user who opens my .idw and prints it

"Joe Sutphin" wrote in message
news:5186369@discussion.autodesk.com...
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
Message 6 of 12

Anonymous
Not applicable
The way I do a similar operation is you have to add a sketch to the drawing,
then add a textbox, put the desired text in the textbox, then print. Then do
the exact reverse to remove everything unless you just want to keep it
there.

"Chris (IV11 Pro. SP1)" wrote in message
news:5187210@discussion.autodesk.com...
Hi Joe,
Not sure to understand your code completely.
To insert this code into the document, the user name will be printed each
time the dwg is sent to the printer?
if so, how???
Thx

"Joe Sutphin" wrote in message
news:5187020@discussion.autodesk.com...
'Windows API declarations
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetNetworkUserName() As String
Dim USERNAME As String
'Create a buffer
USERNAME = String(100, Chr$(0))
'Get the username
GetUserName USERNAME, 100
'strip the rest of the buffer
GetNetworkUserName = Left(USERNAME, InStr(USERNAME, Chr(0)) - 1)
End Function


"Chris (IV11 Pro. SPxx)" wrote in message
news:5186488@discussion.autodesk.com...
I mean the current user who opens my .idw and prints it

"Joe Sutphin" wrote in message
news:5186369@discussion.autodesk.com...
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
Message 7 of 12

Anonymous
Not applicable
Sorry, Joe. I'm totally lost.
Chris
"Joe Sutphin" wrote in message
news:5187241@discussion.autodesk.com...
The way I do a similar operation is you have to add a sketch to the drawing,
then add a textbox, put the desired text in the textbox, then print. Then do
the exact reverse to remove everything unless you just want to keep it
there.

"Chris (IV11 Pro. SP1)" wrote in message
news:5187210@discussion.autodesk.com...
Hi Joe,
Not sure to understand your code completely.
To insert this code into the document, the user name will be printed each
time the dwg is sent to the printer?
if so, how???
Thx

"Joe Sutphin" wrote in message
news:5187020@discussion.autodesk.com...
'Windows API declarations
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetNetworkUserName() As String
Dim USERNAME As String
'Create a buffer
USERNAME = String(100, Chr$(0))
'Get the username
GetUserName USERNAME, 100
'strip the rest of the buffer
GetNetworkUserName = Left(USERNAME, InStr(USERNAME, Chr(0)) - 1)
End Function


"Chris (IV11 Pro. SPxx)" wrote in message
news:5186488@discussion.autodesk.com...
I mean the current user who opens my .idw and prints it

"Joe Sutphin" wrote in message
news:5186369@discussion.autodesk.com...
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
Message 8 of 12

Anonymous
Not applicable
Perhaps I'm the one that's lost.

Please explain in detail exactly what you're attempting to do.

Joe
--

"Chris (IV11 Pro. SP1)" wrote in message
news:5187267@discussion.autodesk.com...
Sorry, Joe. I'm totally lost.
Chris
"Joe Sutphin" wrote in message
news:5187241@discussion.autodesk.com...
The way I do a similar operation is you have to add a sketch to the drawing,
then add a textbox, put the desired text in the textbox, then print. Then do
the exact reverse to remove everything unless you just want to keep it
there.

"Chris (IV11 Pro. SP1)" wrote in message
news:5187210@discussion.autodesk.com...
Hi Joe,
Not sure to understand your code completely.
To insert this code into the document, the user name will be printed each
time the dwg is sent to the printer?
if so, how???
Thx

"Joe Sutphin" wrote in message
news:5187020@discussion.autodesk.com...
'Windows API declarations
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetNetworkUserName() As String
Dim USERNAME As String
'Create a buffer
USERNAME = String(100, Chr$(0))
'Get the username
GetUserName USERNAME, 100
'strip the rest of the buffer
GetNetworkUserName = Left(USERNAME, InStr(USERNAME, Chr(0)) - 1)
End Function


"Chris (IV11 Pro. SPxx)" wrote in message
news:5186488@discussion.autodesk.com...
I mean the current user who opens my .idw and prints it

"Joe Sutphin" wrote in message
news:5186369@discussion.autodesk.com...
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
Message 9 of 12

Anonymous
Not applicable
I mean I'm not sure how to apply your code
Chris
"Joe Sutphin" wrote in message
news:5187739@discussion.autodesk.com...
Perhaps I'm the one that's lost.

Please explain in detail exactly what you're attempting to do.

Joe
--

"Chris (IV11 Pro. SP1)" wrote in message
news:5187267@discussion.autodesk.com...
Sorry, Joe. I'm totally lost.
Chris
"Joe Sutphin" wrote in message
news:5187241@discussion.autodesk.com...
The way I do a similar operation is you have to add a sketch to the drawing,
then add a textbox, put the desired text in the textbox, then print. Then do
the exact reverse to remove everything unless you just want to keep it
there.

"Chris (IV11 Pro. SP1)" wrote in message
news:5187210@discussion.autodesk.com...
Hi Joe,
Not sure to understand your code completely.
To insert this code into the document, the user name will be printed each
time the dwg is sent to the printer?
if so, how???
Thx

"Joe Sutphin" wrote in message
news:5187020@discussion.autodesk.com...
'Windows API declarations
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetNetworkUserName() As String
Dim USERNAME As String
'Create a buffer
USERNAME = String(100, Chr$(0))
'Get the username
GetUserName USERNAME, 100
'strip the rest of the buffer
GetNetworkUserName = Left(USERNAME, InStr(USERNAME, Chr(0)) - 1)
End Function


"Chris (IV11 Pro. SPxx)" wrote in message
news:5186488@discussion.autodesk.com...
I mean the current user who opens my .idw and prints it

"Joe Sutphin" wrote in message
news:5186369@discussion.autodesk.com...
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
Message 10 of 12

Anonymous
Not applicable
Here is the code I use for creating a DWF that has some text and the date in
the lower left hand corner of the DWF. If you want you can email me directly
for further comments or correct me on where I'm misunderstanding you.

Joe
--

BTW, this code depends upon the DWF writer being installed.

Public Sub IDWToDWF()
Dim Index As Long

If ThisApplication.Documents.Count Then
If ThisApplication.ActiveDocumentType = kDrawingDocumentObject Then
If ThisApplication.ActiveDocument.FullFileName = "" Then
MsgBox "Must save IDW before creating DWF!", vbCritical, "Save IDW"
Exit Sub
End If

Else
MsgBox "Active document must be a drawing!", vbCritical, "No active
drawing"
Exit Sub
End If

Else
MsgBox "There must be an open document to continue!", vbCritical, "No
Document Open"
Exit Sub
End If

Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet

'loop through sheets adding text
For Each oSheet In oDrawDoc.Sheets
Dim oDrawingSketch As DrawingSketch

oSheet.Activate

Set oDrawingSketch = oSheet.Sketches.Add

oDrawingSketch.Edit
oDrawingSketch.Visible = True

Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry

Dim sText As String
sText = "DWF - " & Now

Dim oTextBox As TextBox
Set oTextBox =
oDrawingSketch.TextBoxes.AddFitted(oTG.CreatePoint2d(1.25, 1#), sText)

oDrawingSketch.ExitEdit
Next oSheet

Dim oPrintManager As PrintManager
Set oPrintManager = oDrawDoc.PrintManager

With oPrintManager
.Printer = "Autodesk DWF Writer"
Select Case oDrawDoc.ActiveSheet.Size
'inch B size
Case kBDrawingSheetSize
.PaperSize = kPaperSize11x17
'inch C size
Case kCDrawingSheetSize
.PaperSize = kPaperSizeCSheet
'inch D size
Case kDDrawingSheetSize
.PaperSize = kPaperSizeDSheet
'inch E size
Case kEDrawingSheetSize
.PaperSize = kPaperSizeESheet

Case Else
MsgBox "Unknown sheet size - please see administrator!", vbCritical,
"Unknown sheet size"

End Select

.Orientation = kLandscapeOrientation
.ScaleMode = kPrintBestFitScale
.PrintRange = kPrintAllSheets
.SubmitPrint
End With

TakeABreak 5

For Each oSheet In oDrawDoc.Sheets
'activate the sheet to work on
oSheet.Activate
'delete last sketch created, which should be ours
oSheet.Sketches(oSheet.Sketches.Count).Delete
Next oSheet

MsgBox "Finished!", vbExclamation, "DWF Creation Completed"

Set oDrawDoc = Nothing
Set oDrawingSketch = Nothing
Set oSheet = Nothing
Set oTG = Nothing
Set oPrintManager = Nothing
Set oTextBox = Nothing

'UserForm1.Show
End Sub

Private Sub TakeABreak(Duration As Integer)
Dim PauseTime, Start, Finish, TotalTime

PauseTime = Duration 'Set duration
Start = Timer 'Set start time

Do While Timer < Start + PauseTime
DoEvents 'Yield to other processes
Loop

Finish = Timer 'Set end time
End Sub

"Chris (IV11 Pro. SP1)" wrote in message
news:5187899@discussion.autodesk.com...
I mean I'm not sure how to apply your code
Chris
"Joe Sutphin" wrote in message
news:5187739@discussion.autodesk.com...
Perhaps I'm the one that's lost.

Please explain in detail exactly what you're attempting to do.

Joe
--

"Chris (IV11 Pro. SP1)" wrote in message
news:5187267@discussion.autodesk.com...
Sorry, Joe. I'm totally lost.
Chris
"Joe Sutphin" wrote in message
news:5187241@discussion.autodesk.com...
The way I do a similar operation is you have to add a sketch to the drawing,
then add a textbox, put the desired text in the textbox, then print. Then do
the exact reverse to remove everything unless you just want to keep it
there.

"Chris (IV11 Pro. SP1)" wrote in message
news:5187210@discussion.autodesk.com...
Hi Joe,
Not sure to understand your code completely.
To insert this code into the document, the user name will be printed each
time the dwg is sent to the printer?
if so, how???
Thx

"Joe Sutphin" wrote in message
news:5187020@discussion.autodesk.com...
'Windows API declarations
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetNetworkUserName() As String
Dim USERNAME As String
'Create a buffer
USERNAME = String(100, Chr$(0))
'Get the username
GetUserName USERNAME, 100
'strip the rest of the buffer
GetNetworkUserName = Left(USERNAME, InStr(USERNAME, Chr(0)) - 1)
End Function


"Chris (IV11 Pro. SPxx)" wrote in message
news:5186488@discussion.autodesk.com...
I mean the current user who opens my .idw and prints it

"Joe Sutphin" wrote in message
news:5186369@discussion.autodesk.com...
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
Message 11 of 12

Anonymous
Not applicable
Sorry to confuse you guys
Here is what I want:
I run IV on local machine (C-drive). After the design finished, I posted the
files on the server.
If anyone opens the .idw file and sends it to the printer, I want the name
of the that person on the hardcopy
If people in machine shop have a question, they can run into that person in
case I'm not available
I hope it's clear to everyone now
Chris

"Ben Stone" wrote in message
news:5189211@discussion.autodesk.com...
Here is the code I use for creating a DWF that has some text and the date in
the lower left hand corner of the DWF. If you want you can email me directly
for further comments or correct me on where I'm misunderstanding you.

Joe
--

BTW, this code depends upon the DWF writer being installed.

Public Sub IDWToDWF()
Dim Index As Long

If ThisApplication.Documents.Count Then
If ThisApplication.ActiveDocumentType = kDrawingDocumentObject Then
If ThisApplication.ActiveDocument.FullFileName = "" Then
MsgBox "Must save IDW before creating DWF!", vbCritical, "Save IDW"
Exit Sub
End If

Else
MsgBox "Active document must be a drawing!", vbCritical, "No active
drawing"
Exit Sub
End If

Else
MsgBox "There must be an open document to continue!", vbCritical, "No
Document Open"
Exit Sub
End If

Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet

'loop through sheets adding text
For Each oSheet In oDrawDoc.Sheets
Dim oDrawingSketch As DrawingSketch

oSheet.Activate

Set oDrawingSketch = oSheet.Sketches.Add

oDrawingSketch.Edit
oDrawingSketch.Visible = True

Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry

Dim sText As String
sText = "DWF - " & Now

Dim oTextBox As TextBox
Set oTextBox =
oDrawingSketch.TextBoxes.AddFitted(oTG.CreatePoint2d(1.25, 1#), sText)

oDrawingSketch.ExitEdit
Next oSheet

Dim oPrintManager As PrintManager
Set oPrintManager = oDrawDoc.PrintManager

With oPrintManager
.Printer = "Autodesk DWF Writer"
Select Case oDrawDoc.ActiveSheet.Size
'inch B size
Case kBDrawingSheetSize
.PaperSize = kPaperSize11x17
'inch C size
Case kCDrawingSheetSize
.PaperSize = kPaperSizeCSheet
'inch D size
Case kDDrawingSheetSize
.PaperSize = kPaperSizeDSheet
'inch E size
Case kEDrawingSheetSize
.PaperSize = kPaperSizeESheet

Case Else
MsgBox "Unknown sheet size - please see administrator!", vbCritical,
"Unknown sheet size"

End Select

.Orientation = kLandscapeOrientation
.ScaleMode = kPrintBestFitScale
.PrintRange = kPrintAllSheets
.SubmitPrint
End With

TakeABreak 5

For Each oSheet In oDrawDoc.Sheets
'activate the sheet to work on
oSheet.Activate
'delete last sketch created, which should be ours
oSheet.Sketches(oSheet.Sketches.Count).Delete
Next oSheet

MsgBox "Finished!", vbExclamation, "DWF Creation Completed"

Set oDrawDoc = Nothing
Set oDrawingSketch = Nothing
Set oSheet = Nothing
Set oTG = Nothing
Set oPrintManager = Nothing
Set oTextBox = Nothing

'UserForm1.Show
End Sub

Private Sub TakeABreak(Duration As Integer)
Dim PauseTime, Start, Finish, TotalTime

PauseTime = Duration 'Set duration
Start = Timer 'Set start time

Do While Timer < Start + PauseTime
DoEvents 'Yield to other processes
Loop

Finish = Timer 'Set end time
End Sub

"Chris (IV11 Pro. SP1)" wrote in message
news:5187899@discussion.autodesk.com...
I mean I'm not sure how to apply your code
Chris
"Joe Sutphin" wrote in message
news:5187739@discussion.autodesk.com...
Perhaps I'm the one that's lost.

Please explain in detail exactly what you're attempting to do.

Joe
--

"Chris (IV11 Pro. SP1)" wrote in message
news:5187267@discussion.autodesk.com...
Sorry, Joe. I'm totally lost.
Chris
"Joe Sutphin" wrote in message
news:5187241@discussion.autodesk.com...
The way I do a similar operation is you have to add a sketch to the drawing,
then add a textbox, put the desired text in the textbox, then print. Then do
the exact reverse to remove everything unless you just want to keep it
there.

"Chris (IV11 Pro. SP1)" wrote in message
news:5187210@discussion.autodesk.com...
Hi Joe,
Not sure to understand your code completely.
To insert this code into the document, the user name will be printed each
time the dwg is sent to the printer?
if so, how???
Thx

"Joe Sutphin" wrote in message
news:5187020@discussion.autodesk.com...
'Windows API declarations
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetNetworkUserName() As String
Dim USERNAME As String
'Create a buffer
USERNAME = String(100, Chr$(0))
'Get the username
GetUserName USERNAME, 100
'strip the rest of the buffer
GetNetworkUserName = Left(USERNAME, InStr(USERNAME, Chr(0)) - 1)
End Function


"Chris (IV11 Pro. SPxx)" wrote in message
news:5186488@discussion.autodesk.com...
I mean the current user who opens my .idw and prints it

"Joe Sutphin" wrote in message
news:5186369@discussion.autodesk.com...
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes
Message 12 of 12

Anonymous
Not applicable
There are probably a couple of approaches you could take to accomplish this.
At first, I was thinking that you would probably want something like an
OnPrint event so you could add the name to the drawing at the time it is
being printed. Maybe this would still be ideal, but this event does not
currently exist and I was unable to find any other way of being notified
when a print is about to be made.

Because of that I think you would need to add this text to the drawing when
it is opened. You could write an add-in that uses the OnOpenDocument and
checks for when a drawing is opened from a specific location (the server).
It could add the user name at this point. To add the name you could place a
note directly on the sheet or you could have it set up so that a field in
the title block contains the name of the current user. This could be a text
box that references a custom property in the drawing. In the OnOpenDocument
event you could update this property with the name of the current user.

One issue to be aware of with any approach is that when the end-user closes
the document it will ask him if he wants to save it. This may be a bit
confusing because, to them, nothing has changed. A way to solve this is
after setting the value of the property to False. Doing this will make
Inventor think that no change has occurred to the document so it won't think
it needs to be saved. You need to be careful when doing this because if
there have been any changes made that should be saved, they would be lost
too. Doing this as the document is opened and before the end-user has had a
chance to do anything in the document should be ok.
--
Brian Ekins
Autodesk Inventor API


"Chris (IV11 Pro. SP1)" wrote in message
news:5189241@discussion.autodesk.com...
Sorry to confuse you guys
Here is what I want:
I run IV on local machine (C-drive). After the design finished, I posted the
files on the server.
If anyone opens the .idw file and sends it to the printer, I want the name
of the that person on the hardcopy
If people in machine shop have a question, they can run into that person in
case I'm not available
I hope it's clear to everyone now
Chris

"Ben Stone" wrote in message
news:5189211@discussion.autodesk.com...
Here is the code I use for creating a DWF that has some text and the date in
the lower left hand corner of the DWF. If you want you can email me directly
for further comments or correct me on where I'm misunderstanding you.

Joe
--

BTW, this code depends upon the DWF writer being installed.

Public Sub IDWToDWF()
Dim Index As Long

If ThisApplication.Documents.Count Then
If ThisApplication.ActiveDocumentType = kDrawingDocumentObject Then
If ThisApplication.ActiveDocument.FullFileName = "" Then
MsgBox "Must save IDW before creating DWF!", vbCritical, "Save IDW"
Exit Sub
End If

Else
MsgBox "Active document must be a drawing!", vbCritical, "No active
drawing"
Exit Sub
End If

Else
MsgBox "There must be an open document to continue!", vbCritical, "No
Document Open"
Exit Sub
End If

Dim oDrawDoc As DrawingDocument
Set oDrawDoc = ThisApplication.ActiveDocument

Dim oSheet As Sheet

'loop through sheets adding text
For Each oSheet In oDrawDoc.Sheets
Dim oDrawingSketch As DrawingSketch

oSheet.Activate

Set oDrawingSketch = oSheet.Sketches.Add

oDrawingSketch.Edit
oDrawingSketch.Visible = True

Dim oTG As TransientGeometry
Set oTG = ThisApplication.TransientGeometry

Dim sText As String
sText = "DWF - " & Now

Dim oTextBox As TextBox
Set oTextBox =
oDrawingSketch.TextBoxes.AddFitted(oTG.CreatePoint2d(1.25, 1#), sText)

oDrawingSketch.ExitEdit
Next oSheet

Dim oPrintManager As PrintManager
Set oPrintManager = oDrawDoc.PrintManager

With oPrintManager
.Printer = "Autodesk DWF Writer"
Select Case oDrawDoc.ActiveSheet.Size
'inch B size
Case kBDrawingSheetSize
.PaperSize = kPaperSize11x17
'inch C size
Case kCDrawingSheetSize
.PaperSize = kPaperSizeCSheet
'inch D size
Case kDDrawingSheetSize
.PaperSize = kPaperSizeDSheet
'inch E size
Case kEDrawingSheetSize
.PaperSize = kPaperSizeESheet

Case Else
MsgBox "Unknown sheet size - please see administrator!", vbCritical,
"Unknown sheet size"

End Select

.Orientation = kLandscapeOrientation
.ScaleMode = kPrintBestFitScale
.PrintRange = kPrintAllSheets
.SubmitPrint
End With

TakeABreak 5

For Each oSheet In oDrawDoc.Sheets
'activate the sheet to work on
oSheet.Activate
'delete last sketch created, which should be ours
oSheet.Sketches(oSheet.Sketches.Count).Delete
Next oSheet

MsgBox "Finished!", vbExclamation, "DWF Creation Completed"

Set oDrawDoc = Nothing
Set oDrawingSketch = Nothing
Set oSheet = Nothing
Set oTG = Nothing
Set oPrintManager = Nothing
Set oTextBox = Nothing

'UserForm1.Show
End Sub

Private Sub TakeABreak(Duration As Integer)
Dim PauseTime, Start, Finish, TotalTime

PauseTime = Duration 'Set duration
Start = Timer 'Set start time

Do While Timer < Start + PauseTime
DoEvents 'Yield to other processes
Loop

Finish = Timer 'Set end time
End Sub

"Chris (IV11 Pro. SP1)" wrote in message
news:5187899@discussion.autodesk.com...
I mean I'm not sure how to apply your code
Chris
"Joe Sutphin" wrote in message
news:5187739@discussion.autodesk.com...
Perhaps I'm the one that's lost.

Please explain in detail exactly what you're attempting to do.

Joe
--

"Chris (IV11 Pro. SP1)" wrote in message
news:5187267@discussion.autodesk.com...
Sorry, Joe. I'm totally lost.
Chris
"Joe Sutphin" wrote in message
news:5187241@discussion.autodesk.com...
The way I do a similar operation is you have to add a sketch to the drawing,
then add a textbox, put the desired text in the textbox, then print. Then do
the exact reverse to remove everything unless you just want to keep it
there.

"Chris (IV11 Pro. SP1)" wrote in message
news:5187210@discussion.autodesk.com...
Hi Joe,
Not sure to understand your code completely.
To insert this code into the document, the user name will be printed each
time the dwg is sent to the printer?
if so, how???
Thx

"Joe Sutphin" wrote in message
news:5187020@discussion.autodesk.com...
'Windows API declarations
Public Declare Function GetUserName Lib "advapi32.dll" Alias "GetUserNameA"
(ByVal lpBuffer As String, nSize As Long) As Long

Public Function GetNetworkUserName() As String
Dim USERNAME As String
'Create a buffer
USERNAME = String(100, Chr$(0))
'Get the username
GetUserName USERNAME, 100
'strip the rest of the buffer
GetNetworkUserName = Left(USERNAME, InStr(USERNAME, Chr(0)) - 1)
End Function


"Chris (IV11 Pro. SPxx)" wrote in message
news:5186488@discussion.autodesk.com...
I mean the current user who opens my .idw and prints it

"Joe Sutphin" wrote in message
news:5186369@discussion.autodesk.com...
Are you referring to the current user of the machine or who created the
document?

"Chris (IV11 Pro. SPxx)" wrote in message
news:5186316@discussion.autodesk.com...
Is there a way to print user name on a hard copy idw if the the user open
and print my .idw
Thx

--
IV11 Pro. spxx
Window XP Pro sp2
Pentium 3.2 Ghz, 3.0 GB of RAM
NVIDIA FX 3400 8.1.7.2
0 Likes