AutoCAD .NET :: Listing All Xrefs Attached To A Group Of (unopened) Drawings
Aug 15, 2012
I'm using AutoCAD 2013 64 bit and MS Visual Basic 2010 Express (and Excel 2007), and I'm trying to write VB.NET code to list all xrefs attached to a group of drawings. The list of drawings is in column 1 of an Excel spreadsheet, and I want to list all xref filenames in columns 2 onwards - one row per drawing.
The Excel part works fine. I just wish it was as easy to extract information from DWG files.
I created a "Windows Form Application" project in VB 2010 and added a button to Form1. Clicking on the button runs the code.
When adding references I added "Microsoft Excel 12.0 Object Library" COM for Excel (as per Excel website tutorial), and "acdbmgd.dll" and "acmgd.dll" (both with Copy Local=False) as per AutoDesk .NET tutorial. But I got warning messages saying Acdbmgd.dll and Acmgd.dll target a different processor. Is this different to the Excel COM target processor, or do I need to change the target processor for the whole project (and if so, how)?
I tried adding "AutoCAD 2013 Type Library" COM reference instead of "acdbmgd.dll" and "acmgd.dll" which got rid of the target processor warning messages, and I could then open the dwg files successfully, but still the project crashes.
Here's the code so far...
Imports Excel = Microsoft.Office.Interop.Excel
' do I need to include Imports for AutoCAD here? Various websites list AutoDesk.AutoCAD... imports here, but AutoDesk isn't an available option when I try adding this here - maybe because I have the wrong references?
Public Class Form1
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
[Code]....
When I run the project I also get a "A first change exception of type 'System.Runtime.InteropServices.COMException' occurred in MyProject.exe" message. How can I rectify this?
Currently it crashes when it gets to the cadDwg.Database.Blocks line saying "Call was rejected by callee. (Exception from HRESULT: 0x80010001 (RPC_E_CALL_REJECTED))".
The xlsx file and the dwg files refered to in the xlsx file all exist. I've tried running it both with AutoCAD 2013 running and with AutoCAD 2013 not running. Still doesn't work
I feel so close, but what am I missing? I haven't downloaded the "ObjectARX for AutoCAD 2013 (32-bit and 64-bit)" from AutoDesk yet because (i) I have to get a licence, and (ii) it's a very large file, and (iii) I seem to be able to open drawing files without it, but just not access the data I want in the files.
I've got 1500+ drawings to look at by the end of the week. If this doesn't work it's back to AutoLisp (and maybe script files, but that's another headache).
Is there a way for xrefs to stay attached to a drawing file when using Dropbox as a network? All files are saved to the dropbox which is loaded on both computers that need to access the files. If I do work and save an xref in a file that is then opened by someone else on a different computer, the xref is not loaded and has to be re-routed. Is there a way to avoid having to reroute xrefs everytime someone different opens the file?
I'm running Map 2014 SP1 on my machine and the rest of the users in our organization are running Map 2013.
If I save a drawing back to a dwg 2010 version all is fine, but if I save the same drawing to a dwg 2013 version other users are not able to activate and query from it, even though they are otherwise still able to open and work with the drawing.
attach XCdrg1.dwg to Drawing1.dwg attach XCdrg2.dwg to Drawing2.dwg attach XCdrg3.dwg to Drawing3.dwg ..etc...
What is the quickest method? Script? (I have approximately 800 drawings and 800 xrefs and for CAD management reasons they need to be individual drawing files)
I have recently installed Autocad 2014 and am experiencing very slow and jumpy files when using x-refs. The other machines in the office where I work are not experiencing the same problem and apparently my machine is more powerful.
Originally we thought this might be a network issue (as x-refs are being referenced through the network) but when I put the actual reference files on my computer, I experienced the same issue.
I've recently run into a problem that involves xrefs. Basically, I cannot open files that are being xrefed in other drawings when those drawings are currently open. AutoCAD Architecture will only allow me to open the xrefed file as a read-only version. For example:
I have 1ST FLOOR PLAN (drawing file) xrefed into A-201.00 FIRST FLOOR PLAN (sheet file). If one of my team members has the sheet file open with the drawing file loaded, then AutoCAD will only let me open the drawing file as a read-only file. But if my team member has the sheet file open with the drawing file unloaded, then I can open the drawing file without any problems.
I have never had this type of problem with xrefs before and so I'm wondering if it's an AutoCAD Architecture 2012 bug.
I have drawings which are occasionally transmitted to vendors, building officials and other parties. These drawings contain XREFs for the floor plans, roof plans, site plans, etc. Some of these XREFs contain layers with sensitive information the client does not want distributed to third parties.
If I'm just sending a PDF or plotting locally the sensitive layers are turned off or frozen and the PDF is plotted without layers. This is sufficient to protect the sensitive data. But if the third party requests a CAD file then I have a problem.
If I use Send to create a package of dependent files including XREFs they are included whole with all of the sensitive data on frozen layers.
If I Bind the XREF to a copy of the drawing for distribution the sensitive layers are still included as frozen layers.
In either case I am confronted with the task of deleting a large number of layers and we all know what a chore deleting layers with content can be. There has to be a solution to this problem, either an easier way to delete layers or a way to filter them in the binding process. Currently I am removing the XREF and making a block of the essential layers each time I have to make a distribution but these are large and complex drawings making this a chore as well.
Arguably this would be much simpler if AutoCAD had a better method for removing layers such as offering to a. move all contents to layer 0, b. delete all layer contents or c. cancel instead of just telling me I can't delete the layer because there are contents like we're still using R12.
I have noticed the layerstates of the xrefs in my drawings are disappearing. I have to close and reopen the file for them to reappear. Can duplicate this error? At the moment i haven't been able to pinpoint when it happens, but its a first in my experience. I just installed it on another staff members computer so i will see if they get the same problem and report back.
OK. I discovered it occurs when you unload the xrefs, then reload them in the drawing. I was able to duplicate the same problem in a seperate drawing on another computer.
I have been given a set of drawings (300+) and I need to find where and/or if certain blocks (and other objects) are used in these drawings. Is there a utility program or does AutoCAD have the ability to search a group of drawings for a block (by name) and return a list of all the drawings where the block is found.
On that same topic, is there a utility program that will export all the CAD data from a list of drawings to a .csv file or even excel so I can filter and search several drawings for layers, blocks, xrefs etc.
i have a large number of drawings that need xrefs detached and re-attached with the latest model xrefs, any way to do them in bulk rather than opening each individual drawing? the problem started a while back, when opening drawings, ACAD is not loading the latest 'saved' model when opening drawings...
The command RenderFromFile will render the 3D drawing file at C:TempRender.dwg (see this file from attachment), and then write the output image to Render.png at the same folder. The rendered image is on the top view and has visual materials.
The command RenderCurrentView will render the current open 3D drawing, then write the output image to C:TempRender.png. The rendered image is on 3D view and does not have visual materials.
Both two commands call the same shared method RenderToFile(), but their output images are different. I don't know why they are different?
Method RenderToFile is a simplified version from Kean's code. I try to make the code short and simple to easily solve the problem.
I found a function on JTBWorld named listPageSetups, which appears to be meant for listing the pagesetups that exist in an "open" dwg file (as I can get it work for the current dwg). So,
(1) Can this function be used to list page setups in another, un-opened dwg, and, if so, how?
(2) If the answer to (1) is No, is there a LISP way to get a list of page setups from another, un-opened dwg?
i am working on correcting a drawing. when i select a object its layer shows up but then when i try and find the layer in the listing on the layer manager its not there. i can't even select the layer to keep it current.
We use autocad lt 2012, when creating a drawing, the same component can be used more than once, is it possible to print a detail listing of all the components used in a single drawing in some sort of report format, or maybe export the listing to a program like MS excel....etc.
Is there a way to re-order the point file format listing for points on the settings tab? I have tried everything and it will not change the order of the listing.
I have created a circle from 3topo points. Im having difficulty getting accurate elevation (z) of the center of circle (pile representation) via cad polyline listing. im getting same "z" all through out which in fact is not.
Any way to change the order that the parameter properties appear in the property manager. Currently I think they are appearing in the order in which I placed them, but I would likr to re-arrange them.
I checked a couple of old posts looking for a lisp routine that will count the number of lines and list each different length either in a dialog box or txt file. I am working on an estimate and I have a floor plan of owsj of different lengths. I downloaded the tlen.lsp but that is only giving the total number of joists and the total length.
I am looking for a lisp so that I can window all the owsj at once and have it list or show the result for the joist in this manner
sample output:
xx joists = 10'-0" xx joists = 20'-0" xx joists = 30'-0"
I am wondering if there is a way to modify the Map Check Report to include Acreage Calculations like it used to. I am only given the square feet and need both. I know I can calculate it easily, but it would be nice if it were there by default.
Recently installed 2013, previously had 2011inv. Trying to find out exactly what the constraint changes are from 2011 to 2012 inv. I as told that there was a post here with them, but cannot find it (only posts of constraint problems that people were having when they switched to 2012).
what the changes are from inv2011 to 2012 or inv2011 to 2013. Doesn't autodesk have these changes listed somewhere in writting?
I have table, several chairs and some glasses and plates on table. I want to group them and instance that group, hundred of times. Problem is that I do not have materials implemented and I will not until client is satisfied with arrangement. I have problems later, even using many scripts I found, to add material to all instances. Only way is to select one by one.
Other thing is that there might be new objects added into set, so best way would be to add to master group and that will be added in instances of that group automatically, but that does not work with Maya.
When i try to copy paste some drawing entities from a heavy drawing file to any other file, the program blocks and says 'not responding', endlessly. So i always have to shutdown the program. I experience the same problem using the designcenter: when I try to copy a layout into another drawing, my computer gets stuck.
Another annoying problem with these files is that they are so heavy, while in fact they shouldn't be. I tried the aectoacad file command. In result the file id half as big, but after I open it and save it, again is the original size.