Printing Multiple Views?

Printing Multiple Views?

Anonymous
Not applicable
431 Views
5 Replies
Message 1 of 6

Printing Multiple Views?

Anonymous
Not applicable
Hi,
First I am not an Autocad users just the lucky person who gets to try to program this solution. 🙂

Very simply the only thing I need to do is print the "Views" or tabs (with the different pages) that the designers make for the people who don't have autocad but have TrueView (and can print those) and hence the libraries that should be able to do this.

I want to automate this so that with VBA all views will be printed out. (Later I will also want to provide a list of those tabs so individuals can be printed)

I would also rather not have to see any other application interface (i.e. Trueview) besides where I am designing this. (Access)

If someone has a code routine for this or could point out all the methods I would need to do this it would help me tremendously.

TIA
Craig Hornish
0 Likes
432 Views
5 Replies
Replies (5)
Message 2 of 6

arcticad
Advisor
Advisor
Unfortunately, I don't believe you can, Not for free anyways.

You can pay for RealDWG that will allow you to read and write.

This is listed as the development tool for TrueView.

You can also try http://www.opendwg.com/ they have an api for reading and writing to Autocad Files without Autocad. You need to register to get access to the files, It's free.
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes
Message 3 of 6

Anonymous
Not applicable
If it can't be done with TrueView then I would like to back up as see how it is done with the Autocad libraries.

In Autocads code examples they give the code that I put at the end.

What I need are the steps that I need to get "ThisDrawing" object, because the code does print something.

Please I need code examples of what has worked for someone not just the links to other places that I will have to learn their methods. But if you have the code examples for the Opendwg that would be ok - I'll just learn/use that instead of the Autocad libraries - But I can't believe Autocad gives you access to their methods and there is no way to do most of what I asked - what exactly does the (PlotToFile) print?

Thank again
Craig

Sub Example_Plot()
' This example sends a plot of the current drawing
' to a file.

' Define the plot variable
Dim currentPlot As ACADPlot
Set currentPlot = ThisDrawing.Plot

' Define the output file name.
' Use "" to use the drawing name as the file name.
' Note: if the file name exists an error will be generated.
Dim plotFileName As String
plotFileName = "MyPlot"

currentPlot.PlotToFile (plotFileName)

End Sub
0 Likes
Message 4 of 6

arcticad
Advisor
Advisor
PlottoFile creates .plt files

I haven't done anything with opendwg.
I just registered and Downloaded the code.

Opening Autocad in VB. This may explain it better
http://discussion.autodesk.com/thread.jspa?threadID=328699

You can connect the drawing directly with ObjectDBX. This is some good info on that.
I use this all the time in Autocad for VBA and it works great.
It lets me open drawing without loading them in the interface.
http://discussion.autodesk.com/thread.jspa?messageID=5220245

Here is a framework I wrote for Plotting from VBA
http://discussion.autodesk.com/servlet/JiveServlet/download/33-524209-5413917-132097/plotfile.txt

----------------------

I have Autocad 2005 and this is what I have to do for vb.net
You mileage may vary

Set References for
Autocad 2005 Type Library
Autocad/ObjectDBX common 16.0 Type Library

Imports Autodesk.AutoCAD.Interop
Imports Autodesk.AutoCAD.Interop.Common

Function OpenAutocad()
Dim aCAD As AcadApplication
On Error Resume Next
aCAD = GetObject(, "AutoCAD.Application")
If Not Err.Number = 0 Then
Err.Clear()
aCAD = CreateObject("AutoCAD.Application")
If Not Err.Number = 0 Then
MsgBox("*** Error AutoCad is not present ***")
End If
End If
aCAD.Visible = True

Dim Mspace ' Grab Modelspace of Thisdrawing
Mspace = aCAD.ActiveDocument.ModelSpace
MsgBox(Mspace.name)

End Function
---------------------------



(defun botsbuildbots() (botsbuildbots))
0 Likes
Message 5 of 6

Anonymous
Not applicable
Thank you so much for the links and your framework - that is probably what I need. I just briefly went over it and the code with the layouts may just be what I need.

One thing I didn't notice right off (I'll try to look for it but just in case I can't figure it out) is I didn't see were you Dim(med) the ThisDrawing object.

That should be all I need to get started.

Thanks again

Craig
0 Likes
Message 6 of 6

Anonymous
Not applicable
ThisDrawing is somewhat equivalent to AcadApplication.ActiveDocument.

Dim myActiveDwg as AcadDocument
Set myActiveDwg = AcadApplication.ActiveDocument

Note that in AutoCAD's VBA, the ThisDrawing object *always* refers to the
current drawing, even if you switch active drawings in the middle of a
procedure. This behavior is not supported with the above sample.

--
R. Robert Bell


wrote in message news:5419775@discussion.autodesk.com...
Thank you so much for the links and your framework - that is probably what I
need. I just briefly went over it and the code with the layouts may just be
what I need.

One thing I didn't notice right off (I'll try to look for it but just in
case I can't figure it out) is I didn't see were you Dim(med) the
ThisDrawing object.

That should be all I need to get started.

Thanks again

Craig
0 Likes