Jump to content

Copy pline from drawing and -without opening the second document- paste it into existing dwg, run lisp routine and exit


meinfilel

Recommended Posts

Hello, everyone,

 

I'm writing some pretty basic autolisp routines for practice & I've come across this problem: I need to select a single polyline from an open dwg file, paste it with basepoint 0,0 to a "close" dwg that is saved on my desktop, run a lisp routine on this new file and close it without making any saves.

 

I've searched a little and found this nice routine from lee mac: http://lee-mac.com/copytodrawing.html and it does almost what I want; I mean I will remove the prompt about the "destination" files but that's the easy part. What I need to be done is to run a script to the "close" file without opening it on the editor. Terms like Object DBX or ActiveX elements have confused me very much but I'm willing to study about them if they can help me. If I have gotten it correct, Object DBX is something a "database" from which I can access elements of dwg files without actually opening these files in the acad application. Can this be expanded to run a script in this file?

 

Thanks for your time in advance.

Link to comment
Share on other sites

ObjectDBX allows you to open a DWG for read/write and optionally make changes to the DWG file, but you are limited in what actions you can take.

The DWG is simply opened in memory and not in the AutoCAD graphical editor, and because so, certain actions are forbidden, such as asking the user to make a selection (since that is impossible). But if you wanted to draw a line from 5,5 to 8,3 - this could be done. Obviously, because the DWG is not being opened in the editor, making changes to multiple drawings is lightning fast.

 

LeeMac has some good examples of this here: http://www.lee-mac.com/odbxbase.html

 

  • Like 2
Link to comment
Share on other sites

16 hours ago, rkmcswain said:

ObjectDBX allows you to open a DWG for read/write and optionally make changes to the DWG file, but you are limited in what actions you can take.

The DWG is simply opened in memory and not in the AutoCAD graphical editor, and because so, certain actions are forbidden, such as asking the user to make a selection (since that is impossible). But if you wanted to draw a line from 5,5 to 8,3 - this could be done. Obviously, because the DWG is not being opened in the editor, making changes to multiple drawings is lightning fast.

 

LeeMac has some good examples of this here: http://www.lee-mac.com/odbxbase.html

 

 

Thanks! I've look into the page and understood some things.

I got that it isn't possible to run a lisp subfunction through ObjectDBX if it includes (command "line") etc (from lee mac's comments on the subfunction).

What would be the best way to achieve my goal that is running a existing specific lisp without opening the dwg file? I think maybe ObjectDBX isn't my best choice.

 

I'm uploading my lisp with the dwg that I want it to run on. My ultimate goal is to bring the blue rectangle with red arrow/text inside the green box and run (aprint), which I have commented out in the file beloew because it's printer-specific; that wouldn't change much though if the general procedure.

 

Thanks in advance!

cadtut.lsp cadtut.dwg

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...