Jump to content

Binding multiple Drawings Automation


Cad_Jockeys

Recommended Posts

Hello all. I was wondering if it would be possible for someone to write a vba/lisp automation to bind and then plot multiple drawings. I have 100+ drawings that need to be plotted/pdf and the task is very tedious when done manually. Any help would be great. Thanks in advance.

 

-Cad Jockeys

Link to comment
Share on other sites

DO you know any VB already. What I have written, calls from different methods in AutoCAD that are not totally present in the code I can give.

Link to comment
Share on other sites

This may raise more questions than it answers. Keep asking. I am sure we can help as you ask.

 

Public Function BindXrefs()
'------------------------------------------------------------------------------
'Binds Xrefs to drawing without prefix
'Delete Xref from drawing and then insert file and explode it
'------------------------------------------------------------------------------
Dim acBlkRef As AcadBlockReference
Dim sXref As String
'''''''''''''''''''''''''''''''''''''''
On Error GoTo ErrHandler

sXref = GetXrefPath

If sXref <> "" Then
   sXref = dhTrimLeft(sXref, "\", True, -1) 'Remove path info
   sXref = dhTrimRight(sXref, ".") 'Remove .dwg extension
   ThisDrawing.SendCommand "-XREF" & vbCr & "D" & vbCr & sXref & vbCr
   ThisDrawing.PurgeAll
   sXref = sXref & ".dwg"
   acBlkRef = InsertBlkRef(sXref)
   Set acBlkRef = Nothing
End If
   
ExitHere:
   Exit Function
ErrHandler:
   Debug.Print Err.Number, Err.description, "Function 'BindXrefs' Failed"
End Function
Private Function GetXrefPath() As String
'------------------------------------------------------------------------------
'
'Returns:   XREF drawing path i.e. "1000-01_01.dwg"
'Caveats:   Assuming no nested xrefs and only one per drawing
'------------------------------------------------------------------------------
Dim acXref As AcadExternalReference
Dim acSS As AcadSelectionSet
Dim acBlks As AcadBlocks
Dim acBlk As AcadBlock
Dim acEnt As AcadEntity
Dim sPath As String
Dim sEntType As String
'''''''''''''''''''''''''''''''''''''''
On Error GoTo ErrHandler

sEntType = "INSERT"
Set acSS = GetEntitySS(sEntType)
Set acBlks = ThisDrawing.Blocks

For Each acEnt In acSS
   Set acBlk = acBlks(acEnt.Name)
   If acBlk.IsXRef Then
       Set acXref = acEnt
       sPath = acXref.Path
       Exit For
   End If
Next acEnt

GetXrefPath = sPath

ExitHere:
   Exit Function
ErrHandler:
   Debug.Print Err.Number, Err.description, "Function 'GetXrefPath' Failed"
End Function

Link to comment
Share on other sites

  • 3 months later...

mr. borgunit

I created a *.txt and pasted the code then renamed to bind.dvb

when trying to load in autocad there is a wrong message saying "WRONG FILE FORMAT"

Is what i did correct or not?

 

and there are more questions

- Is this code will do the 2 steps ( bind then plot to PDF) without opening the file?

- Will ask me about the files path?

- could that code create a folder (called BOUND) to save the original dwgs or should i make a copy?

- Will the saving of the PDF files being in the same path (or new folder as well)?

- Will ask me about the layout (if the file has multiable layouts) which i want to plot?

- Will ask me about the plotting configuration?

 

Sorry for too much questions.

Link to comment
Share on other sites

under the "File" menu, about half way down, its called "eTransmit"

 

it will automatically issue drawings, as a zip, .exe or into a folder, in whichever format, and will bind xref's if you want it to.

 

plus it sends fonts, plot styles and files with the dwg's, so when the person at the other end opens them, there are no issues.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...