Author Topic: Psetup in (Plotconfigs)  (Read 8660 times)

0 Members and 1 Guest are viewing this topic.

Bob Wahr

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #15 on: March 17, 2008, 07:06:36 PM »
Why would they be any more likely to be able to edit an imported pagesetup, than a pagesetup that was created by VBA, or for that matter, on that was done manually.  After a pagesetup is created, regardless of the method of creation, it can be edited.

ML

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #16 on: March 18, 2008, 09:34:27 AM »

Yes, I actually agree with you Bob; unfortunately the methodology in which we use is not my decision to make.
I am basically told what we need and I then try to get the result.
I did look at code for creating the Plot Configs via code, it looks pretty cut and dry.
After this, I will give that a try. I am sure that it will be a useful methodology to have for other things as well.

Mark

ML

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #17 on: March 18, 2008, 10:22:00 AM »

Matt
I just got to looking at the module you attached.
I really like the way the openfiledia code is laid out; that will certainly be useful.
I still need to look at the psetup part.

You may know this already, but under UserAccounts in Windows, there is also a Common Dia Method

Code: [Select]
Dim objDialog As Variant
 Dim intResult As Variant
 Dim Variable as String
 
'Call FileOpenDialog
 Set objDialog = CreateObject("UserAccounts.CommonDialog")

 objDialog.Filter = "Image File (*.tif)|*.tif|All Files|*.*"
 objDialog.FilterIndex = 1
 objDialog.InitialDir = ThisDrawing.Path
 intResult = objDialog.ShowOpen
 
 If intResult = 0 Then
  Exit Sub
 Else
  Variable = objDialog.FileName
 End If
 

It does not have the extensibility as the openfiledia code in your project but if you only need it for a lousy file, this method works very nice and is "very" short.

Mark

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Psetup in (Plotconfigs)
« Reply #18 on: March 18, 2008, 10:59:23 AM »
ML, I hear what your saying, but it is very hard to beat the speed of clicking 1 button and being done.  The code inside that button is already loaded in memory, as it gets loaded at startup.  I dont have to go find a file to import from, I just set the config I want, and send it to the plotter.  Thats it.  In fact, for some of my users, I purge out all their page setups because they give them weird names, and then cant figure out where their plot went (read which printer).

As you said, to each his own.  If your interested, I'll post my setup code
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

ML

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #19 on: March 18, 2008, 11:10:17 AM »

Absolutely CM
Post away man, Post away.

Earlier in this post, Bob eluded to dbx, I wasn't familiar with that, then I saw Matt's code
Sorry Bob!

Code: [Select]
ThisDrawing.Application.GetInterfaceObject("ObjectDBX.AxDbDocument.17")

I did not realize that you had to make a connection to import a lousy Pagesetup.

If you are doing LISP or an ACAD menu macro; you simply do
Menu Macro:  -psetupin;code away;
LISP:  (command "psetupin" "path" "code")

So, this shows that LISP (at times) is better and easier then VBA.

Never thought I would hear myself say that? :)

Yeah, let's see your code CM

Thanks!

Mark

Bob Wahr

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #20 on: March 18, 2008, 11:24:46 AM »
Well crap, I thought you wanted to do it programatically.  If you can do it with Command in lisp, you can do it with thisdrawing.sendcommand in VBA

ML

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #21 on: March 18, 2008, 11:27:42 AM »

Yes, this is true Bob.
I could do that.

I'd still be interested in understanding the way Matt's code is doing it, just for future reference

Mark


Guest

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #22 on: March 18, 2008, 11:43:26 AM »

Yes, this is true Bob.
I could do that.

I'd still be interested in understanding the way Matt's code is doing it, just for future reference

Mark



What I've posted will list all of the page setups in a drawing - helpful if you don't know the name of the page setup you want to import.  But if you already know what you want to import (and it sounds like you do) just use -PSETUPIN behind a button and call it a day.

ML

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #23 on: March 18, 2008, 11:47:52 AM »

Hey Matt

Yep!
That is already done in LISP using a pulldown.

Still, I like The way The FileDia code is situated, that is certainly worth keeping around

Thanks!
Mark

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Psetup in (Plotconfigs)
« Reply #24 on: March 18, 2008, 12:39:25 PM »
the first snippet is what gets called from a button.  I have 3 buttons, 1 for 11x17, 1 for C-Size and 1 for D-Size.  These all make prints using the predefined setups.

the second does just a setup, no plot.

the third is the routine that actually does the work.  It takes arguments from either the first or second snippet and applies as needed.  808 gets credit for helping me with this code.

Code: [Select]
Public Sub Vendor1117()
      Call SetupAndPlot("11x17Draft.pc3", "11X17-CHECKSET.ctb", "ANSI_B_(11.00_x_17.00_Inches)", acScaleToFit, ac90degrees)
      ThisDrawing.Plot.PlotToDevice
      ThisDrawing.Close (True)
End Sub

Public Sub SetupVendor1117()
      Call SetupAndPlot("11x17Draft.pc3", "11X17-CHECKSET.ctb", "ANSI_B_(11.00_x_17.00_Inches)", acScaleToFit, ac90degrees)
End Sub

Public Sub SetupAndPlot(ByRef Plotter As String, CTB As String, SIZE As String, PSCALE As String, ROT As String)
      Dim Layout As AcadLayout
      On Error GoTo Err_Control
      Set Layout = ThisDrawing.ActiveLayout
      Layout.RefreshPlotDeviceInfo
      Layout.ConfigName = Plotter    ' CALL PLOTTER
      Layout.PlotType = acExtents
      Layout.PlotRotation = ROT    ' CALL ROTATION
      Layout.StyleSheet = CTB    ' CALL CTB FILE
      Layout.PlotWithPlotStyles = True
      Layout.PlotViewportBorders = False
      Layout.PlotViewportsFirst = True
      Layout.CanonicalMediaName = SIZE    ' CALL SIZE
      Layout.PaperUnits = acInches
      Layout.StandardScale = PSCALE    'CALL PSCALE
      Layout.ShowPlotStyles = False
      ThisDrawing.Plot.NumberOfCopies = 1

      Layout.CenterPlot = True
      Layout.ScaleLineweights = False
      ThisDrawing.Regen acAllViewports
      ZoomExtents
      Set Layout = Nothing
      ThisDrawing.Save
Exit_Here:
      Exit Sub
Err_Control:
      Select Case Err.Number
            Case "-2145320861"
                  MsgBox "Unable to Save Drawing- " & Err.Description
            Case "-2145386493"
                  MsgBox "Drawing is setup for Named Plot Styles." & (Chr(13)) & (Chr(13)) & "Run CONVERTPSTYLES command", vbCritical, "Change Plot Style"
            Case Else
                  MsgBox "Unknown Error " & Err.Number
      End Select
End Sub
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

ML

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #25 on: March 18, 2008, 12:59:07 PM »

Hey CM
Very good!

Yes, I have seen a few examples like this.

Thanks!
Mark

Guest

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #26 on: March 18, 2008, 01:06:11 PM »
the first snippet is what gets called from a button.  I have 3 buttons, 1 for 11x17, 1 for C-Size and 1 for D-Size.  These all make prints using the predefined setups.

the second does just a setup, no plot.

I should set up something like that here for making quick prints/plots.  Thanks for the idea!   :wink:

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Psetup in (Plotconfigs)
« Reply #27 on: March 18, 2008, 01:20:50 PM »
I actually have 6 buttons, 3 for 1 ctb 3 for the other.  All of them pass the arguments to the same setup sub.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

ML

  • Guest
Re: Psetup in (Plotconfigs)
« Reply #28 on: March 18, 2008, 01:21:49 PM »
I think it is very cool of course
Still, I like the idea of having a drawing with all my predefined setups, then just importing them in.
Still, I see some good uses for this too

Like I said earlier, to do a pagesetupin is pretty easy with LISP.

CM, are you using all CTB?

We were all CTB here but migrating to STB.

Believe it or not, all my past experience was STB, this is the first environment that I worked in that used CTB.

I definitively prefer STB and styles over color dependent.

Mark

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: Psetup in (Plotconfigs)
« Reply #29 on: March 18, 2008, 01:44:50 PM »
Still, I like the idea of having a drawing with all my predefined setups, then just importing them in.
Very valid.  I prefer to maintain 1 dvb instead of a dwg
Like I said earlier, to do a pagesetupin is pretty easy with LISP.
to do it in lisp or use the Command function?  Using command is no better than using ThisDrawing.SendCommand
CM, are you using all CTB?
We were all CTB here but migrating to STB.
Believe it or not, all my past experience was STB, this is the first environment that I worked in that used CTB.
I definitively prefer STB and styles over color dependent.
Once again, to each his own.  Trying to convert to STB after years of CTB is a logistic nightmare.  I dont feel like trying to go down that road with my current group of users.  If I had a few more advanced users, I might give it a go.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)