Convert Paperspace drawings to Modelspace

Convert Paperspace drawings to Modelspace

Anonymous
Not applicable
548 Views
6 Replies
Message 1 of 7

Convert Paperspace drawings to Modelspace

Anonymous
Not applicable
Our company's standard is PaperSpace, but one of our customers demands all
files to be just ModelSpace. Does anyone have a VBA program that would look
at files and determine if there Paper or Model? If Paper is TRUE than to
run the express tool to convert: CHSPACE.

John Laidler
Cad Manager
Duckworth & Associates, Inc.
(734) 455-7500
0 Likes
549 Views
6 Replies
Replies (6)
Message 2 of 7

Anonymous
Not applicable
Hi John - Just off the top of my head, if the drawing is completely done in
ModelSpace, then the PaperSpace collection should be empty, that is, in a VBA
routine: "ThisDrawing.PaperSpace.Count = 0". If it's not zero, then run CHSpace
I assume. (I've never used it.) Hope this helps...

...Colin French

John Laidler wrote:

> Our company's standard is PaperSpace, but one of our customers demands all
> files to be just ModelSpace. Does anyone have a VBA program that would look
> at files and determine if there Paper or Model? If Paper is TRUE than to
> run the express tool to convert: CHSPACE.
>
> John Laidler
> Cad Manager
> Duckworth & Associates, Inc.
> (734) 455-7500
0 Likes
Message 3 of 7

Anonymous
Not applicable
how in VBA can you execute an AutoCAD command??
I'm pretty new to VBA, if you haven't noticed.

--
John Laidler
Cad Manager
Duckworth & Associates, Inc.
(734) 455-7500
"Colin French" wrote in message
news:[email protected]...
> Hi John - Just off the top of my head, if the drawing is completely done
in
> ModelSpace, then the PaperSpace collection should be empty, that is, in a
VBA
> routine: "ThisDrawing.PaperSpace.Count = 0". If it's not zero, then run
CHSpace
> I assume. (I've never used it.) Hope this helps...
>
> ...Colin French
>
> John Laidler wrote:
>
> > Our company's standard is PaperSpace, but one of our customers demands
all
> > files to be just ModelSpace. Does anyone have a VBA program that would
look
> > at files and determine if there Paper or Model? If Paper is TRUE than
to
> > run the express tool to convert: CHSPACE.
> >
> > John Laidler
> > Cad Manager
> > Duckworth & Associates, Inc.
> > (734) 455-7500
>
0 Likes
Message 4 of 7

Anonymous
Not applicable
From the VBA help

Sub Example_SendCommand()
' This example sends a command to the AutoCAD commandline
' of a particular drawing for evaluation

' We will create a Circle in the active drawing and will
' zoom to display the entire circle
ThisDrawing.SendCommand "_Circle" & vbCr & "2,2,0" & vbCr & "4" & vbCr
ThisDrawing.SendCommand "_zoom" & vbCr & "a" & vbCr

' Refresh view

ThisDrawing.Regen acAllViewports

MsgBox "A circle command has been sent to the command line of the current
drawing."
End Sub

Bernard
ATC
45700 Villemandeur
France
John Laidler a écrit dans le message :
[email protected]...
> how in VBA can you execute an AutoCAD command??
> I'm pretty new to VBA, if you haven't noticed.
>
> --
> John Laidler
> Cad Manager
> Duckworth & Associates, Inc.
> (734) 455-7500
> "Colin French" wrote in message
> news:[email protected]...
> > Hi John - Just off the top of my head, if the drawing is completely done
> in
> > ModelSpace, then the PaperSpace collection should be empty, that is, in
a
> VBA
> > routine: "ThisDrawing.PaperSpace.Count = 0". If it's not zero, then run
> CHSpace
> > I assume. (I've never used it.) Hope this helps...
> >
> > ...Colin French
> >
> > John Laidler wrote:
> >
> > > Our company's standard is PaperSpace, but one of our customers
demands
> all
> > > files to be just ModelSpace. Does anyone have a VBA program that
would
> look
> > > at files and determine if there Paper or Model? If Paper is TRUE than
> to
> > > run the express tool to convert: CHSPACE.
> > >
> > > John Laidler
> > > Cad Manager
> > > Duckworth & Associates, Inc.
> > > (734) 455-7500
> >
>
0 Likes
Message 5 of 7

Anonymous
Not applicable
Hello folks,

With VBA this should be easy to write. Try the Layout collection and
property. Modelspace or "Model" is the last number of the Layout collection,
if I remember well.

Try for example:

Dim objLayout as AcadLayout
With ThisDrawing
Set objLayout = .Layouts(.Layouts.Count - 1)
ThisDrawing.ActiveLayout = objLayout
End With

Henk

Bernard Flavignard schreef in berichtnieuws
[email protected]...
> From the VBA help
>
> Sub Example_SendCommand()
> ' This example sends a command to the AutoCAD commandline
> ' of a particular drawing for evaluation
>
> ' We will create a Circle in the active drawing and will
> ' zoom to display the entire circle
> ThisDrawing.SendCommand "_Circle" & vbCr & "2,2,0" & vbCr & "4" & vbCr
> ThisDrawing.SendCommand "_zoom" & vbCr & "a" & vbCr
>
> ' Refresh view
>
> ThisDrawing.Regen acAllViewports
>
> MsgBox "A circle command has been sent to the command line of the
current
> drawing."
> End Sub
>
> Bernard
> ATC
> 45700 Villemandeur
> France
> John Laidler a écrit dans le message :
> [email protected]...
> > how in VBA can you execute an AutoCAD command??
> > I'm pretty new to VBA, if you haven't noticed.
> >
> > --
> > John Laidler
> > Cad Manager
> > Duckworth & Associates, Inc.
> > (734) 455-7500
> > "Colin French" wrote in message
> > news:[email protected]...
> > > Hi John - Just off the top of my head, if the drawing is completely
done
> > in
> > > ModelSpace, then the PaperSpace collection should be empty, that is,
in
> a
> > VBA
> > > routine: "ThisDrawing.PaperSpace.Count = 0". If it's not zero, then
run
> > CHSpace
> > > I assume. (I've never used it.) Hope this helps...
> > >
> > > ...Colin French
> > >
> > > John Laidler wrote:
> > >
> > > > Our company's standard is PaperSpace, but one of our customers
> demands
> > all
> > > > files to be just ModelSpace. Does anyone have a VBA program that
> would
> > look
> > > > at files and determine if there Paper or Model? If Paper is TRUE
than
> > to
> > > > run the express tool to convert: CHSPACE.
> > > >
> > > > John Laidler
> > > > Cad Manager
> > > > Duckworth & Associates, Inc.
> > > > (734) 455-7500
> > >
> >
>
0 Likes
Message 6 of 7

Anonymous
Not applicable
Ooh, I see another posting with answers that go a very different direction
(I think I misunderstood your problem). It keeps tricky: multiple posts with
the same subject.

Greetings,
Henk
0 Likes
Message 7 of 7

Anonymous
Not applicable
the program needs to convert Paperspace entities to Modelspace. I have most
of the code, now I just need to add code so when it detects more than 1
viewport it will select the first viewport created.

here is the code so far:

Public Sub ConvertDrawing()
Dim objLayout As AcadLayout
Dim objLayouts As AcadLayouts
Set objLayouts = ThisDrawing.Layouts
If ThisDrawing.ActiveSpace = acPaperSpace Then
ThisDrawing.SendCommand "CHSPACE" & vbCr & "all" & vbCr & vbCr
Else
End If
End Sub

--
John Laidler
Cad Manager
Duckworth & Associates, Inc.
(734) 455-7500
"Henk Loonstra" wrote in message
news:[email protected]...
> Ooh, I see another posting with answers that go a very different direction
> (I think I misunderstood your problem). It keeps tricky: multiple posts
with
> the same subject.
>
> Greetings,
> Henk
>
0 Likes