See the top rated post in this thread. Click here

Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 23

Thread: Creating a DWF automatically on save

  1. #11
    100 Club mtuersley's Avatar
    Join Date
    2001-12
    Posts
    122
    Login to Give a bone
    0

    Default Re: Creating a DWF automatically on save

    Sure. You can read my articles on CADalyst for basic info on single and/or multi=page dwf output.

    From there, you need to decide when this should occur. I'd use the Close event instead of when saving. Just add code to fire for that event and you'll have it.

    Post back if you run into problems.

    Good Luck!

  2. #12
    Member
    Join Date
    2004-09
    Posts
    10
    Login to Give a bone
    0

    Default Re: Creating a DWF automatically on save

    Thanks for your help

    I have got this code working to a certain extent but it displays the Publish Drawing Sheets form which I don;t really want it to do, I just want it to publish the DWF in the background and close.

    I am using the following line, which I thought would turn off forms

    .SetVariable "FILEDIA", 0

    Thanks

    Daniel

  3. #13
    100 Club mtuersley's Avatar
    Join Date
    2001-12
    Posts
    122
    Login to Give a bone
    0

    Default Re: Creating a DWF automatically on save

    You'd need to post more code to determine exactly. Here are some thoughts though:

    1. Are you publish a multi-page dwf? If not, don't use Publish, use Print and a DWF driver
    2. Might need to turn of CMDDIA [CMDDIA = 0]
    3. You need to access the publish command using "-PUBLISH"
    4. Make sure background processing is turned off [BACKGROUNDPLOT = 0]

  4. #14
    Member
    Join Date
    2004-09
    Posts
    10
    Login to Give a bone
    0

    Default Re: Creating a DWF automatically on save

    I will sometimes be doing a multi-page DWF. Shall I do a check and see if its going to be a multi-page DWF use publish, but if not just use the print command.

    Heres some of the code

    Dim sTxt As String

    'grab the drawing variables we need
    dwgName = ThisDrawing.FullName
    'check to make sure we have layouts
    If cLayOuts.Count > 0 Then
    'build the DSD file name
    dsdFile = Replace(dwgName, ".dwg", ".dsd")
    'build the DWF file name
    d wfFile = Replace(dwgName, ".dwg", ".dwf")
    ' create the DSD file
    If CreateDSDFile(cLayOuts, dsdFile, dwgName) = True Then
    'publish our multipage DWF file
    With ThisDrawing
    sTxt = Replace(dsdFile, "\", "/")
    'turn FILEDIA *OFF* to avoid dialog boxes
    .SetVariable "FILEDIA", 0
    .SetVariable "EXPERT", 0

    .Regen acActiveViewport
    'Publish layouts

    sCommand = "(command " & Chr(34) & _
    "QSAVE" & Chr(34) _
    & ")" & vbCr

    .SendCommand (sCommand)

    sCommand = "(command " & Chr(34) & _
    "_PUBLISH" & Chr(34) & _
    " " & Chr(34) & sTxt & _
    Chr(34) & " " & Chr(34) & " " & Chr(34) & ")" & vbCr

    .SendCommand (sCommand)
    End With
    Else

  5. #15
    100 Club mtuersley's Avatar
    Join Date
    2001-12
    Posts
    122
    Login to Give a bone
    0

    Default Re: Creating a DWF automatically on save

    Okay. Replace "_PUBLISH" with "-PUBLISH" and add .SetVariable "BACKGROUNDPLOT", 0. Unless you are specifcally testing for the SAVE command, remove the QSAVE and just use .Save [NEVER use SendCommand unless you absolutely have to, which you don't here].

    As for a single sheet, you can still use the publish command. I just wouldn't use it if you're always going to be kicking out single-page DWFs.

  6. #16
    Member
    Join Date
    2004-09
    Posts
    10
    Login to Give a bone
    0

    Default Re: Creating a DWF automatically on save

    When setting the BACKGOUNDPLOT. I get an error saying. Error setting system variable.

    Is there another setting i need to set before setting this.

    Thanks very much for your help, I really do appretiate it. I am pretty new to CAD Development.

    Daniel

  7. #17
    The Silent Type Mike.Perry's Avatar
    Join Date
    2000-11
    Posts
    13,656
    Login to Give a bone
    0

    Default Re: Creating a DWF automatically on save

    Quote Originally Posted by barnesd
    When setting the BACKGOUNDPLOT. I get an error saying. Error setting system variable.
    Hi

    I don't know VBA, but I notice you missed an "R" in the above ie

    BACKGOUNDPLOT should be BACKGROUNDPLOT

    Could that be the problem (or was the above just a typo)?

    Have a good one, Mike

  8. #18
    Member
    Join Date
    2004-09
    Posts
    10
    Login to Give a bone
    1

    Default Re: Creating a DWF automatically on save

    Unfortunetly this was just a typo on the message board, But thanks for point it out.

  9. #19
    100 Club mtuersley's Avatar
    Join Date
    2001-12
    Posts
    122
    Login to Give a bone
    0

    Default Re: Creating a DWF automatically on save

    I don't believe so... post the portion of your code where you set it and whatever you do before that. Here's what I normally set:

    With m_cadApp.ActiveDocument
    .SetVariable("FILEDIA", 0)
    .SetVariable("CMDDIA", 0)
    .SetVariable("ATTREQ", 0)
    .SetVariable("BACKGROUNDPLOT", 0)
    End With

  10. #20
    Member
    Join Date
    2004-08
    Posts
    41
    Login to Give a bone
    0

    Default Re: Creating a DWF automatically on save

    just check if this will help u...

    To get your drg name u can try this code..
    Filename=ThisDrawing.FullName

    Also create a pc3 file for your dwf.
    Then try this code to get a plot for pc3
    result = ThisDrawing.Plot.PlotToFile(plotFileName, "c:\folder\pc3filename.pc3")

    santhosh

Page 2 of 3 FirstFirst 123 LastLast

Similar Threads

  1. Replies: 0
    Last Post: 2011-10-24, 03:45 PM
  2. 2012: Save to earlier version automatically
    By andrewp in forum AutoCAD General
    Replies: 8
    Last Post: 2011-08-03, 12:58 PM
  3. Creating acaddoc.lsp automatically
    By harilalmn in forum AutoCAD General
    Replies: 1
    Last Post: 2010-11-26, 08:43 AM
  4. Creating Shortcut in OPEN/SAVE dialog box
    By Dhanjeet in forum Revit Architecture - Tips & Tricks
    Replies: 3
    Last Post: 2006-03-08, 10:53 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •