Hi All,
I am running into an issue where I think software versioning is creating a problem within my LISP routine.
The LISP function reads some reference tables and uses the information within them to open DWGS, update block values across multiple DWG files, save and close the files.
But because the files are Civil 3D DWG files, the content starts to have errors opening automatically with the default 'vanilla' AutoCAD (such as tabs / content being deleted). I know that you can specify the version of AutoCAD to be opened (AutoCAD.Application.18 etc), but to open Civil 3D you don't open it like a normal exe, but call on the acad.exe for AutoCAD 2020 with some additional options enabled.
Is it possible to specify to open DWGs in Civil 3D via LISP? I am running this function from within Civil 3D 2020.
strcat "AutoCAD.Application.(Civil3D2020???)"
Screencap of code section below (cant post the full code)
Cheers,
Ewan
Autodesk ITF 2018-2020 / Senior Project Drafter / Technical & Computational Modelling Specialist / Dynamo Enthusiast
Solved! Go to Solution.
Solved by Sea-Haven. Go to Solution.
Something like this
(defun openblk (blkname / adocs)
(setq acDocs (vla-get-documents (vlax-get-acad-object)))
(vla-open acDocs blkname)
(vla-activate (vla-item acdocs 1))
;(vla-put-activedocument (vlax-get-acad-object) (vla-item acdocs 1))
)
Thanks for the quick reply.
Is that forcing the LISP to be run within the current session of Civil3D? So as to not open a new instance of acad.exe to open the DWG files to be processed by the block?
Cheers,
Ewan
Autodesk ITF 2018-2020 / Senior Project Drafter / Technical & Computational Modelling Specialist / Dynamo Enthusiast
- Code Snip from solution -
(setq exc_data nil) ;debug only
(alert " Please wait as Block attributes are extracted...")
(setq acapp (vlax-get-acad-object))
(setq adocs (vla-get-documents acapp))
Yep, vlax-get-acad-object was the key 🙂
Thanks for your assistance @Sea-Haven , really appreciated.
Cheers,
Ewan
Autodesk ITF 2018-2020 / Senior Project Drafter / Technical & Computational Modelling Specialist / Dynamo Enthusiast
Can't find what you're looking for? Ask the community or share your knowledge.