CAD Forum - tips, tricks, discussion and utilities for AutoCAD, Inventor, Revit and other Autodesk products [www.cadforum.cz]
Cesky English Deutsch
Login/Register:
 Visitors: 2890 

CAD tip CAD tip # 7381:

Question CAD 
 %  platform  category 
Q - question

How to open another DWG file from LISP?

A - answer If you want to open a different DWG drawing from your LISP application, the solution is apparently simple:
(command "_.OPEN" "d:\\drawings\\mydrawing.dwg")
in higher AutoCAD versions use:
(command "_.FILEOPEN" "d:\\drawings\\mydrawing.dwg")
But this method works only in the single document environment (SDI=1). In the default multiple document environment (MDI; SDI=0), this function creates a new document and activates it. But it doesn't pass the filename parameter properly as the command execution returns immediately back to the original document (drawing).

To solve this problem, you can use VisualLISP and the ActiveX interface in AutoCAD. You can invoke the open method for another document with these commands (program control will return to the original document):

(setq acApp (vlax-get-acad-object))
(setq acDocs (vla-get-documents acApp))
(vla-open acDocs "d:/drawings/mydrawing.dwg")
ACAD
100% *  CAD 
1.6.2010    13279×  
Comments   Tell a friend
applies to: AutoCAD ·

See also:
Tip 11608:Trim to rectangle - cut out a part of a DWG drawing.
Tip 11604:How to set plot transparency for all layouts in a DWG?
Tip 11511:Assigning elevations to 2D contours (isolines).
Tip 11505:Get name of the original Revit BIM model from DWG files in AutoCAD.
Tip 11502:How to detect DWG files created as an export from Autodesk Revit?


Back   All CAD Tips All CAD tips&tricks

Visual styles in Inventor 2011. « | » How to extrude a profile along an arc or curve?

Have we helped you? If you want to support the CAD Forum web service, consider buying one of our CAD applications, or our custom software development offerings, or donating via PayPal (see above). You may also add a link to your web - like this "fan" link: CAD Forum - tips, utilities, blocks for Autodesk products
CAD:    OS:    Categ: 
Text:  FAQ glossary   



Featuring:
Increase your productivity with our set of BIM add-on functions for Autodesk Revit
CADstudio Revit Tools More info


Please use these tips at your own risk.
CAD Studio (Xanadu) is not responsible for possible problems that may occur as a result of using any of these tips.
TOPlist