View Full Version : Open Xref File lsp
WannaBeCader
24th Jun 2005, 04:44 am
After working w/ Version 04 and xrefs, I have become attached, (get it?..Xref's/attached :D ) with the open xref file from the modify pull-down menu, but at home I have ver 02. If any of you CAD genius's know a lisp routine that will open a xref file by picking on the xref I will promise no more jokes :(
Murph
24th Jun 2005, 01:06 pm
Would a VBA macro do?
Sub OpenXref()
If ThisDrawing.GetVariable("SDI") > 1 Then
MsgBox "AutoCAD is currently operating in fixed SDI mode!"
'continue the open xref process yes/no
Exit Sub
End If
If ThisDrawing.GetVariable("SDI") = 1 Then
ThisDrawing.SetVariable "SDI", 0
End If
Dim ASel As AcadSelectionSet
Dim FilterType(0) As Integer
Dim FilterData(0) As Variant
Dim ent As AcadEntity
Dim BRef As AcadBlockReference
Dim Blk As AcadBlock
Dim XRef As AcadExternalReference
Dim ZHgt As Double
Dim Pnt As Variant
Dim VTwist As Double
Dim ZoomTo As String
Dim SetLayers As String
Dim oLSM As AcadLayerStateManager
Dim InLine As String
Dim OutLine As String
Dim TempPath As String
NoTemp:
FilterType(0) = 0
FilterData(0) = "INSERT"
Err.Clear
On Error Resume Next
Set ASel = ThisDrawing.SelectionSets("Inserts")
If Err.Number <> 0 Then
Set ASel = ThisDrawing.SelectionSets.Add("Inserts")
End If
ASel.Clear
ThisDrawing.Utility.Prompt vbNewLine & "Select xrefs to open..."
ASel.SelectOnScreen FilterType, FilterData
For Each ent In ASel
Set BRef = ent
Set Blk = ThisDrawing.Blocks.Item(BRef.Name)
If Blk.IsXRef = True Then
Set XRef = ent
Err.Clear
On Error Resume Next
ThisDrawing.Application.Documents.Open XRef.path
If Err.Number <> 0 Then
MsgBox Err.Description & " when trying to open: " & XRef.path
GoTo TryNext
End If
End If
TryNext:
Next
End Sub
WannaBeCader
25th Jun 2005, 06:12 am
Thanks Murph. I'll have to read up on macros, so for now I can still try to be humorous
Murph
26th Jun 2005, 06:23 pm
Type VBAIDE at the command line.
Paste the above code into Module1.
Save it as any name you want.
Type Appload, add the new dvb file you created to the Briefcase contents.
To run it type -vbastmt OpenXref.
You can make a toolbar button and program it to run this macro using the
command
^C^C-vbastmt "OpenXref";
WannaBeCader
1st Jul 2005, 04:53 am
Ya know Murph you are right, "what can go wrong......."
I don't know if is ok to be asking you about macro's when I should be getting the books out, but........
How do you save as a .dvb file? I went file >export nad it created a .txt file. What did do wrong?
Murph
1st Jul 2005, 05:17 pm
In the Visual Basic window (VBAIDE will get you there) hit the save button.
It should prompt you for a location and filename.
WannaBeCader
2nd Jul 2005, 04:40 pm
Got It!!!!
Made a button with the command ^C^C-vbastmt "openxref". Deleted the "-", (mabe my version 02 doesnt have a transparent vbastmt?) and then I'm prompted for the expression (I type "openxref") and it works like a charm. Maybe I need to and a comma or something, I'll play in while.
You're awesome! Thanks NY!!
Powered by vBulletin™ Version 4.1.2 Copyright © 2012 vBulletin Solutions, Inc. All rights reserved.