NirantarVidyarthee Posted February 19, 2013 Posted February 19, 2013 How do I connect to and use AutoCA mechanical API using Visual Lisp. I have tried hard but can't find how to do this. Plrase help. Quote
MSasu Posted February 19, 2013 Posted February 19, 2013 To see how AutoLISP interact with AutoCAD, I suggest you to follow a tutorial - the one at AfraLISP for example. For a more precise response, it will be useful to describe what you are intending to automate. Quote
NirantarVidyarthee Posted February 19, 2013 Author Posted February 19, 2013 Thank you but I am talking of AutoCAD Mechanical. I am trying to add balloons using visual lisp. Quote
SEANT Posted February 19, 2013 Posted February 19, 2013 I'm inferring a bit here, from old VBA experience, but what happens if this is used? (setq symBB (vla-getinterfaceobject (vlax-get-acadobject)"SymBBAuto.McadSymbolBBMgr.3")) Quote
BlackBox Posted February 19, 2013 Posted February 19, 2013 Being entirely unfamiliar with Mechanical specifically, your best best is to look at the ActiveX (COM) API Documentation (either VBA, or .NET)... So long as Mechanical supports that, many/most/all? of those Objects, Properties, and Methods will be available via LISP (generally speaking). Quote
NirantarVidyarthee Posted February 20, 2013 Author Posted February 20, 2013 I already tried that but it gives me error ; error: Automation Error. Problem in loading application Also documentation does not explain this. Once I can get hold of the symb object, then VBA documentation can help. Quote
BIGAL Posted February 20, 2013 Posted February 20, 2013 This is an example of adding a civ3d point it should be similar for Mechanical open database then open subset and add. The hardest thing is finding variable names for gets & puts. Google a fair bit and gradually it comes together. In this example we add points you can have surfaces, alignments etc A few more variables available inI code would be ptnum and description. Use dumpit.lsp on existing object or code below (Vl-load-com) (setq e (entsel )) (setq obj (vlax-ename->vla-object (car e))) (vlax-dump-object obj T) ;; Change ProgID per Traget Civil 3D version ;; This code sample is meant for Civil 3D 2013 (setq aeccApp (vla-getinterfaceobject (vlax-get-acad-object) "AeccXUiLand.AeccApplication.10.0" ) ; 2013 is 10.0 ) (setq aeccDoc (vlax-get-property aeccApp "ActiveDocument")) (setq oPoints (vlax-get-property aeccDoc "Points")) (setq pt1 (vlax-3d-point '(10.0 10.0 1.0))) (setq oPoint1 (vlax-invoke-method oPoints "Add" pt1)) (vlax-put opoint1 'labelrotation 1.57) ;approx 90deg (setq pt1 (vlax-3d-point '(20.0 10.0 2.0))) (setq oPoint1 (vlax-invoke-method oPoints "Add" pt1)) (vlax-put opoint1 'labelrotation 3.14) ;approx 180deg (setq pt1 (vlax-3d-point '(20.0 20.0 3.0))) (setq oPoint1 (vlax-invoke-method oPoints "Add" pt1)) (vlax-put opoint1 'labelrotation 4.71) ;approx 270deg Quote
NirantarVidyarthee Posted February 20, 2013 Author Posted February 20, 2013 Thank you BIGAL. But I have not come across equivalent of "AeccXUiLand.AeccApplication.10.0" for AutoCAD mechanical How did you find this value? Is it documented somewhere? Quote
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.