Hi all and thanks for your answers!
Basically I will have two opened files: the first will be for 3D objects where I will get some distances and store them into variables in order to draw some views and sections on the second file, which will be only for 2D elements.
I have been trying with the below code, playing with opening and closing files in order to move between active drawings, but it does not work.
This code is a simple example of getting coordinates of two selected points in first drawing in order to draw a line between them on the second one.
(defun c:3dprogram ()
;SAVE 3D FILE PATH
(setq 3Dfilepath (getvar "dwgprefix"))
(setq 3Dfilename (getvar "dwgname"))
(setq 3Dfilepath (strcat 3Dfilepath 3Dfilename))
(setq leftpoint (getpoint "\nLeft point : "))
(setq rightpoint (getpoint "\nRight point : "))
;OPEN 2D FILE
(setq 2dfile (findfile (getfiled "Select file" "" "dwg" 8)))
(setq 2Dfilepath (vl-filename-directory 2dfile))
(setq 2Dfilename (vl-filename-base 2dfile))
(setq 2Dfilepath (strcat 2Dfilepath "\\" 2Dfilename ".dwg"))
(vla-open
(vla-get-documents
(vla-get-application (vlax-get-acad-object))
)
2Dfilepath
)
;CLOSE 3D FILE
(command "_qsave")
(command "_close")
(command "_pline" leftpoint rightpoint "")
(princ)
)
The error comes like this: error: "failed to set debug break position"
I presume this is because the code is loaded only in the first 3D file so when the 3D file closes it is not capable to draw the pline on the second file. Any thoughts? I thought that, the same way there are programms working for a batch of drawings this would be possible between two of them.