Squiggs Posted September 23, 2008 Share Posted September 23, 2008 Hello All, My CADD department has tens of thousands of files that all seem to have an unused external reference to a file that no longer exists. I am trying to automate a way to go through all these files and remove the external refrences programatically. I have found several posts of people iterating through the ThisDrawing.Blocks and looking for Blocks that are XRefs, however none of these blocks are flagged as XRefs. Is there another way to delete these references? Thanks for your help. Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted September 23, 2008 Share Posted September 23, 2008 if its the same name for every dwg, I would use a script, which is very easy to write. open dwgname xref d "xrefname" " " qsave close repeat above with new dwg number Quote Link to comment Share on other sites More sharing options...
ASMI Posted September 23, 2008 Share Posted September 23, 2008 Blocks and looking for Blocks that are XRefs, however none of these blocks are flagged as XRefs. Is there another way to delete these references? Yes. XRefs have Path property (path to XRef file) but ordinary blocks havn't. Quote Link to comment Share on other sites More sharing options...
Squiggs Posted September 23, 2008 Author Share Posted September 23, 2008 The name is indeed very similar between the files, the all have the same external reference, but a handful have a few more. What language is the script posted by CmdrDuh? This doesn't look like VB, how can I implement that? Or by ASMI's suggestion, do I iterate through the ThisDrawing.Blocks collection and just look for a Path that is not 'Nothing' even if the IsXRef property is false and remove it? Or am I looking at the wrong collection altogether? Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted September 23, 2008 Share Posted September 23, 2008 A script file is just text, not a particular language. What you want can be done in any language, VBA, LISP, or just a script. A script is the "typed" version of your commands, so if you were to do this from the Keyboard, and write down all the steps, including "Returns/Enter" to accept the defaults, that would be a script that the computer would follow. An example, how to draw a line by script: line 0,0 1,1 0,2 qsave line command followed by space (which if you did from the keyboard would issue the line command, typed coordinates 0,0 to be first point, 1,1 to be second point. Notice the space between 0,0 and 1,1, another "enter" as if i had typed it at the keyboard. On to 0,2, and then 2 spaces, 1 to process the 0,2 and the second to give the line command a blank "Enter" to stop the command. Then a qsave to save the dwg. Does this make sense? Quote Link to comment Share on other sites More sharing options...
Squiggs Posted September 23, 2008 Author Share Posted September 23, 2008 how do I execute these scripts? Its not a .bat or .vbs file then? Whats the launcher app? Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted September 23, 2008 Share Posted September 23, 2008 drag and drop on a blank dwg file from explorer. Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted September 23, 2008 Share Posted September 23, 2008 copy and paste this into notepad and save as c:\test.scr (or whatever you want) , open a blank dwg, save it as something, and then drag and drop the file line 0,0 2,2 0,5 qsavezoom e zoom 0.5x qsave Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted September 23, 2008 Share Posted September 23, 2008 and you can write a script file very rapidlly if you use a little DOS magic to build your list of dwgs. I can help with that as well if you need it Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted September 23, 2008 Share Posted September 23, 2008 how do I execute these scripts? Its not a .bat or .vbs file then? Whats the launcher app? you can also type scr at command prompt and browse to find the scr file Quote Link to comment Share on other sites More sharing options...
Squiggs Posted September 24, 2008 Author Share Posted September 24, 2008 Thanks for the help with this. The scripting is working pretty good, but revealed a new issue. The files that are listed in the External References window are not showing up as XRefs in the command window. If we type "-xref ?" in the command window, it says there are no XRefs. However the file clearly shows up in the External References window with a red exclamation mark. Any idea how to remove these items? Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted September 24, 2008 Share Posted September 24, 2008 I tried to detach an xref that was unresolved( had a red exclamation mark) and it detached. In my script, I put the name i wanted to detach and it took it. Quote Link to comment Share on other sites More sharing options...
Squiggs Posted September 24, 2008 Author Share Posted September 24, 2008 Here is an example of one of the drawings we're working with (a blank template in this case). Would you mind trying it on this one? 8000-1 no image.dwg Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted September 24, 2008 Share Posted September 24, 2008 I found your problem, ALLTEMP1 is not an xref, Its an image. If you type -image d alltemp1 it will detach the image for you Quote Link to comment Share on other sites More sharing options...
Squiggs Posted September 24, 2008 Author Share Posted September 24, 2008 Thanks a lot for your help on this, someone else had just mentioned to me that images and external references are in the same window now in 2009, which is why I thought it was an external reference. Your solution is working great. I am in your debt. Quote Link to comment Share on other sites More sharing options...
CmdrDuh Posted September 24, 2008 Share Posted September 24, 2008 no problems Quote Link to comment Share on other sites More sharing options...
Recommended Posts
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.