| Author |
Message |
A-Design
Guest
|
Posted:
Fri Apr 08, 2005 8:54 pm Post subject:
Print layer's name |
|
|
Hi,
Is it possible to write a code to print all layer's names.
Thanks,
A.K.
|
|
| Back to top |
|
 |
Joe Sutphin
Guest
|
Posted:
Fri Apr 08, 2005 9:03 pm Post subject:
Re: Print layer's name |
|
|
Are you referring to print as in "to a printer" or to display as in a
messagebox?
Joe
--
"A-Design" <afshinstock@hotmail.com> wrote in message
news:4256b75c$1_1@newsprd01...
| Quote: | Hi,
Is it possible to write a code to print all layer's names.
Thanks,
A.K.
|
|
|
| Back to top |
|
 |
A-Design
Guest
|
Posted:
Fri Apr 08, 2005 9:13 pm Post subject:
Re: Print layer's name |
|
|
It was much better if I could first see them in a msgbox then send the
contents of that msgbox to the printer.
Thanks.
"Joe Sutphin" <joesutphin@earthlink.net> wrote in message
news:4256b964$1_1@newsprd01...
| Quote: | Are you referring to print as in "to a printer" or to display as in a
messagebox?
Joe
--
"A-Design" <afshinstock@hotmail.com> wrote in message
news:4256b75c$1_1@newsprd01...
Hi,
Is it possible to write a code to print all layer's names.
Thanks,
A.K.
|
|
|
| Back to top |
|
 |
Joe Sutphin
Guest
|
Posted:
Fri Apr 08, 2005 9:18 pm Post subject:
Re: Print layer's name |
|
|
Here is the quick and dirty way.
Public Sub ListLayers()
Dim oLayer As AcadLayer
For Each oLayer In ThisDrawing.Layers
Debug.Print oLayer.Name
Next oLayer
End Sub
Then highlight everything in the immediate window [Ctrl-A].
C/P it to Notepad and print it.
If you need a more substantial and permanently method then let me know.
Joe
--
"A-Design" <afshinstock@hotmail.com> wrote in message
news:4256bb9a$1_3@newsprd01...
| Quote: | It was much better if I could first see them in a msgbox then send the
contents of that msgbox to the printer.
Thanks.
"Joe Sutphin" <joesutphin@earthlink.net> wrote in message
news:4256b964$1_1@newsprd01...
Are you referring to print as in "to a printer" or to display as in a
messagebox?
Joe
--
"A-Design" <afshinstock@hotmail.com> wrote in message
news:4256b75c$1_1@newsprd01...
Hi,
Is it possible to write a code to print all layer's names.
Thanks,
A.K.
|
|
|
| Back to top |
|
 |
Oberer
Guest
|
Posted:
Fri Apr 08, 2005 9:26 pm Post subject:
Re: Print layer's name |
|
|
If you want the layer names sorted, you'll need to add them to an array or collection & process accordingly.
Alternatively, you could always import this text file into excel and do a quick sort there...
| Code: |
Sub listem_V2()
Dim oLYR As AcadLayer
Dim strTemp As String
Dim strFullFileName As String
'output filename & path
' must make sure any directory(s) you specify here exist already
strFullFileName = "g:\MyNewTest.TXT"
strTemp = strTemp & "Begin Layer Listing" & vbNewLine
'ThisDrawing.Utility.Prompt "Begin Layer Listing"
'AcadApplication.Update
For Each oLYR In ThisDrawing.Layers
'Debug.Print oLYR.Name
'ThisDrawing.Utility.Prompt oLYR.Name
'AcadApplication.Update
strTemp = strTemp & oLYR.Name & vbNewLine
Next
'output to file
WriteStringToFile strFullFileName, strTemp
' view in notepad
SendFileToNotePad strFullFileName
End Sub
Sub WriteStringToFile(pFileName As String, pString As String)
Dim intFileNum As Integer
intFileNum = FreeFile
Open pFileName For Output As intFileNum
Print #intFileNum, pString
Close intFileNum
End Sub
Sub SendFileToNotePad(pFileName As String)
Dim lngReturn As Long
lngReturn = Shell("NOTEPAD.EXE " & pFileName, vbNormalFocus)
End Sub
|
|
|
| Back to top |
|
 |
A-Design
Guest
|
Posted:
Fri Apr 08, 2005 9:52 pm Post subject:
Re: Print layer's name |
|
|
Thank you Obere this is very nice.
"Oberer" <nospam@address.withheld> wrote in message
news:5659186.1112981193172.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | If you want the layer names sorted, you'll need to add them to an array or
collection & process accordingly.
Alternatively, you could always import this text file into excel and do a
quick sort there...
| Code: |
Sub listem_V2()
Dim oLYR As AcadLayer
Dim strTemp As String
Dim strFullFileName As String
'output filename & path
' must make sure any directory(s) you specify here exist already
strFullFileName = "g:\MyNewTest.TXT"
strTemp = strTemp & "Begin Layer Listing" & vbNewLine
'ThisDrawing.Utility.Prompt "Begin Layer Listing"
'AcadApplication.Update
For Each oLYR In ThisDrawing.Layers
'Debug.Print oLYR.Name
'ThisDrawing.Utility.Prompt oLYR.Name
'AcadApplication.Update
strTemp = strTemp & oLYR.Name & vbNewLine
Next
'output to file
WriteStringToFile strFullFileName, strTemp
' view in notepad
SendFileToNotePad strFullFileName
End Sub
Sub WriteStringToFile(pFileName As String, pString As String)
Dim intFileNum As Integer
intFileNum = FreeFile
Open pFileName For Output As intFileNum
Print #intFileNum, pString
Close intFileNum
End Sub
Sub SendFileToNotePad(pFileName As String)
Dim lngReturn As Long
lngReturn = Shell("NOTEPAD.EXE " & pFileName, vbNormalFocus)
End Sub
|
|
|
|
| Back to top |
|
 |
A-Design
Guest
|
Posted:
Fri Apr 08, 2005 9:52 pm Post subject:
Re: Print layer's name |
|
|
Thanks Joe.
"Joe Sutphin" <joesutphin@earthlink.net> wrote in message
news:4256bcdd_3@newsprd01...
| Quote: | Here is the quick and dirty way.
Public Sub ListLayers()
Dim oLayer As AcadLayer
For Each oLayer In ThisDrawing.Layers
Debug.Print oLayer.Name
Next oLayer
End Sub
Then highlight everything in the immediate window [Ctrl-A].
C/P it to Notepad and print it.
If you need a more substantial and permanently method then let me know.
Joe
--
"A-Design" <afshinstock@hotmail.com> wrote in message
news:4256bb9a$1_3@newsprd01...
It was much better if I could first see them in a msgbox then send the
contents of that msgbox to the printer.
Thanks.
"Joe Sutphin" <joesutphin@earthlink.net> wrote in message
news:4256b964$1_1@newsprd01...
Are you referring to print as in "to a printer" or to display as in a
messagebox?
Joe
--
"A-Design" <afshinstock@hotmail.com> wrote in message
news:4256b75c$1_1@newsprd01...
Hi,
Is it possible to write a code to print all layer's names.
Thanks,
A.K.
|
|
|
| Back to top |
|
 |
A-Design
Guest
|
Posted:
Fri Apr 08, 2005 10:02 pm Post subject:
Re: Print layer's name |
|
|
Oberer,
Can I also have information like COLOR,ON and OFF ,FREEZE & Etc. of each
layer on that list ?
Thanks
A.K.
"Oberer" <nospam@address.withheld> wrote in message
news:5659186.1112981193172.JavaMail.jive@jiveforum1.autodesk.com...
| Quote: | If you want the layer names sorted, you'll need to add them to an array or
collection & process accordingly.
Alternatively, you could always import this text file into excel and do a
quick sort there...
| Code: |
Sub listem_V2()
Dim oLYR As AcadLayer
Dim strTemp As String
Dim strFullFileName As String
'output filename & path
' must make sure any directory(s) you specify here exist already
strFullFileName = "g:\MyNewTest.TXT"
strTemp = strTemp & "Begin Layer Listing" & vbNewLine
'ThisDrawing.Utility.Prompt "Begin Layer Listing"
'AcadApplication.Update
For Each oLYR In ThisDrawing.Layers
'Debug.Print oLYR.Name
'ThisDrawing.Utility.Prompt oLYR.Name
'AcadApplication.Update
strTemp = strTemp & oLYR.Name & vbNewLine
Next
'output to file
WriteStringToFile strFullFileName, strTemp
' view in notepad
SendFileToNotePad strFullFileName
End Sub
Sub WriteStringToFile(pFileName As String, pString As String)
Dim intFileNum As Integer
intFileNum = FreeFile
Open pFileName For Output As intFileNum
Print #intFileNum, pString
Close intFileNum
End Sub
Sub SendFileToNotePad(pFileName As String)
Dim lngReturn As Long
lngReturn = Shell("NOTEPAD.EXE " & pFileName, vbNormalFocus)
End Sub
|
|
|
|
| Back to top |
|
 |
Matt W
Guest
|
Posted:
Fri Apr 08, 2005 10:18 pm Post subject:
Re: Print layer's name |
|
|
Change this line: strTemp = strTemp & oLYR.Name & vbNewLine
to this line: strTemp = strTemp & oLYR.Name & "," & oLYR.Color & "," &
oLYR.Linetype & "," & oLYR.Freeze & "," & oLYR.LayerOn & vbNewLine
This will create a comma delimited file with layer name, color, linetype,
freeze state (expressed as boolean), on/off state (expressed as boolean)
--
I support two teams: The Red Sox and whoever beats the Yankees.
"A-Design" <afshinstock@hotmail.com> wrote in message
news:4256c74d$1_3@newsprd01...
| Quote: | Oberer,
Can I also have information like COLOR,ON and OFF ,FREEZE & Etc. of each
layer on that list ?
Thanks
A.K.
"Oberer" <nospam@address.withheld> wrote in message
news:5659186.1112981193172.JavaMail.jive@jiveforum1.autodesk.com...
If you want the layer names sorted, you'll need to add them to an array
or collection & process accordingly.
Alternatively, you could always import this text file into excel and do a
quick sort there...
| Code: |
Sub listem_V2()
Dim oLYR As AcadLayer
Dim strTemp As String
Dim strFullFileName As String
'output filename & path
' must make sure any directory(s) you specify here exist already
strFullFileName = "g:\MyNewTest.TXT"
strTemp = strTemp & "Begin Layer Listing" & vbNewLine
'ThisDrawing.Utility.Prompt "Begin Layer Listing"
'AcadApplication.Update
For Each oLYR In ThisDrawing.Layers
'Debug.Print oLYR.Name
'ThisDrawing.Utility.Prompt oLYR.Name
'AcadApplication.Update
strTemp = strTemp & oLYR.Name & vbNewLine
Next
'output to file
WriteStringToFile strFullFileName, strTemp
' view in notepad
SendFileToNotePad strFullFileName
End Sub
Sub WriteStringToFile(pFileName As String, pString As String)
Dim intFileNum As Integer
intFileNum = FreeFile
Open pFileName For Output As intFileNum
Print #intFileNum, pString
Close intFileNum
End Sub
Sub SendFileToNotePad(pFileName As String)
Dim lngReturn As Long
lngReturn = Shell("NOTEPAD.EXE " & pFileName, vbNormalFocus)
End Sub
|
|
|
|
| Back to top |
|
 |
Matt W
Guest
|
Posted:
Fri Apr 08, 2005 10:22 pm Post subject:
Re: Print layer's name |
|
|
That is slick!
Man could I have used that many-a-time in the past!
--
I support two teams: The Red Sox and whoever beats the Yankees.
"Joe Sutphin" <joesutphin@earthlink.net> wrote in message
news:4256cac9_2@newsprd01...
| Quote: | See attached DVB file.
Joe
--
"A-Design" <afshinstock@hotmail.com> wrote in message
news:4256c74d$1_3@newsprd01...
Oberer,
Can I also have information like COLOR,ON and OFF ,FREEZE & Etc. of each
layer on that list ?
Thanks
A.K.
"Oberer" <nospam@address.withheld> wrote in message
news:5659186.1112981193172.JavaMail.jive@jiveforum1.autodesk.com...
If you want the layer names sorted, you'll need to add them to an array
or
collection & process accordingly.
Alternatively, you could always import this text file into excel and do
a
quick sort there...
| Code: |
Sub listem_V2()
Dim oLYR As AcadLayer
Dim strTemp As String
Dim strFullFileName As String
'output filename & path
' must make sure any directory(s) you specify here exist already
strFullFileName = "g:\MyNewTest.TXT"
strTemp = strTemp & "Begin Layer Listing" & vbNewLine
'ThisDrawing.Utility.Prompt "Begin Layer Listing"
'AcadApplication.Update
For Each oLYR In ThisDrawing.Layers
'Debug.Print oLYR.Name
'ThisDrawing.Utility.Prompt oLYR.Name
'AcadApplication.Update
strTemp = strTemp & oLYR.Name & vbNewLine
Next
'output to file
WriteStringToFile strFullFileName, strTemp
' view in notepad
SendFileToNotePad strFullFileName
End Sub
Sub WriteStringToFile(pFileName As String, pString As String)
Dim intFileNum As Integer
intFileNum = FreeFile
Open pFileName For Output As intFileNum
Print #intFileNum, pString
Close intFileNum
End Sub
Sub SendFileToNotePad(pFileName As String)
Dim lngReturn As Long
lngReturn = Shell("NOTEPAD.EXE " & pFileName, vbNormalFocus)
End Sub
|
|
|
|
| Back to top |
|
 |
Oberer
Guest
|
Posted:
Fri Apr 08, 2005 11:47 pm Post subject:
Re: Print layer's name |
|
|
It's folks like you Joe who keep me coming back. There's SO much to learn.
Very nice utliity.
One request?
How would i had the word app until it's finished formatting?
I'm working with acad 2k2 and ld3 on xp sp 2, p4 3.6, 2 gigs of ram and the table formatting was kinda slow. I didn't realize it wasn't finished until i get a few more hourglasses... |
|
| Back to top |
|
 |
A-Design
Guest
|
Posted:
Sat Apr 09, 2005 12:23 am Post subject:
Re: Print layer's name |
|
|
Thank you all very much.
"Matt W" <nospam@address.withheld.com> wrote in message
news:4256cae8_3@newsprd01...
| Quote: | Change this line: strTemp = strTemp & oLYR.Name & vbNewLine
to this line: strTemp = strTemp & oLYR.Name & "," & oLYR.Color & "," &
oLYR.Linetype & "," & oLYR.Freeze & "," & oLYR.LayerOn & vbNewLine
This will create a comma delimited file with layer name, color, linetype,
freeze state (expressed as boolean), on/off state (expressed as boolean)
--
I support two teams: The Red Sox and whoever beats the Yankees.
"A-Design" <afshinstock@hotmail.com> wrote in message
news:4256c74d$1_3@newsprd01...
Oberer,
Can I also have information like COLOR,ON and OFF ,FREEZE & Etc. of each
layer on that list ?
Thanks
A.K.
"Oberer" <nospam@address.withheld> wrote in message
news:5659186.1112981193172.JavaMail.jive@jiveforum1.autodesk.com...
If you want the layer names sorted, you'll need to add them to an array
or collection & process accordingly.
Alternatively, you could always import this text file into excel and do
a quick sort there...
| Code: |
Sub listem_V2()
Dim oLYR As AcadLayer
Dim strTemp As String
Dim strFullFileName As String
'output filename & path
' must make sure any directory(s) you specify here exist already
strFullFileName = "g:\MyNewTest.TXT"
strTemp = strTemp & "Begin Layer Listing" & vbNewLine
'ThisDrawing.Utility.Prompt "Begin Layer Listing"
'AcadApplication.Update
For Each oLYR In ThisDrawing.Layers
'Debug.Print oLYR.Name
'ThisDrawing.Utility.Prompt oLYR.Name
'AcadApplication.Update
strTemp = strTemp & oLYR.Name & vbNewLine
Next
'output to file
WriteStringToFile strFullFileName, strTemp
' view in notepad
SendFileToNotePad strFullFileName
End Sub
Sub WriteStringToFile(pFileName As String, pString As String)
Dim intFileNum As Integer
intFileNum = FreeFile
Open pFileName For Output As intFileNum
Print #intFileNum, pString
Close intFileNum
End Sub
Sub SendFileToNotePad(pFileName As String)
Dim lngReturn As Long
lngReturn = Shell("NOTEPAD.EXE " & pFileName, vbNormalFocus)
End Sub
|
|
|
|
| Back to top |
|
 |
|
|
|
|