Faouweb Posted December 18, 2011 Share Posted December 18, 2011 Hi, When we use Macros in Excel we can see the code, this is an example when i record a macro in Excel: Sub Macro1() ' ' Macro1 Macro ' ' ActiveCell.FormulaR1C1 = "12" Range("A2").Select ActiveCell.FormulaR1C1 = "30" Range("A3").Select ActiveCell.FormulaR1C1 = "=SUM(R[-2]C:R[-1]C)" Range("A4").Select End Sub I have tried in AutoCAD but I can't see anything. How can I do it? Thank you Quote Link to comment Share on other sites More sharing options...
dirkvandonkelaar Posted December 18, 2011 Share Posted December 18, 2011 here is an guide about macro making and editing, i hope this is what you need. http://www.ellenfinkelstein.com/acadblog/record-macros-with-the-action-recorder/ Quote Link to comment Share on other sites More sharing options...
Faouweb Posted December 18, 2011 Author Share Posted December 18, 2011 here is an guide about macro making and editing, i hope this is what you need. http://www.ellenfinkelstein.com/acadblog/record-macros-with-the-action-recorder/ Thank you. It's said in the web site : Action Recorder macros have some limitations: You can’t open files You can’t grip edit or use PRESSPULL You can’t load VBA files Macros also don’t record changes to a dialog box, which means that you may need to use the command line version of a command. If you’ve worked with scripts, you’re familiar with this type of functioning. You may find other limitations. I want to do an example with VBA in AutoCAD like for example drawing a rectangle or a circle. There is no enough tutorial on this field Quote Link to comment Share on other sites More sharing options...
BIGAL Posted December 19, 2011 Share Posted December 19, 2011 VBAMAN opens up the VBA editor There is no VBA macro recorder unlike Word & Excel, you need to write VBA code from scratch copy and paste stuff you can find at places like here Autodesk really dropped the ball with macro record its almost useless compared to Corelcad it writes .NET code as its defualt. Anyway here is some examples Set objTXT = ThisDrawing.ModelSpace.AddText(textVal, varPT2, textSize) objTXT.Layer = "TEXT" objTXT.Rotation = dtr(90) objTXT.color = acYellow varPT1 = ThisDrawing.Utility.GetPoint(, "Pick Datum Point: ") startCH = ThisDrawing.Utility.GetReal("Enter Start CH: ") acdLINE = ThisDrawing.ModelSpace.AddLine(startPOINT, endPOINT) Quote Link to comment Share on other sites More sharing options...
BlackBox Posted December 19, 2011 Share Posted December 19, 2011 I agree with Al regarding Action Recorder - tested it myself, and never used it again. Separately, I'd suggest that you start learning .NET in lieu of VBA which is no longer supported and is dead or dying. Perhaps VB.NET would be a good place to start given your familiarity with VBA, but you *may* find the need to learn C# at some point also. Coding in .NET will especially come in handy when coding for newer versions, if not verticals. HTH Quote Link to comment Share on other sites More sharing options...
Faouweb Posted December 19, 2011 Author Share Posted December 19, 2011 Ok I have a googd idea now . What about AutoLISP? I bought an old book "Inside AutoLISP" i'm in the end of Chapter 2, I hope I'm not wasting time Quote Link to comment Share on other sites More sharing options...
BlackBox Posted December 19, 2011 Share Posted December 19, 2011 Learning LISP will serve you well; especially for common, repetitive tasks, etc. and has the ability of performing very complex tasks as well (thanks to ActiveX). Learning .NET can be much more advanced, and is especially applicable when coding for verticals (i.e., Civil 3D, Map 3d, etc.) IMO. ** Edit - As for books, I learned a lot about LISP from David Stein's "The Visual LISP Developer's Bible" which is now out in a 2011 edition as well. Quote Link to comment Share on other sites More sharing options...
Faouweb Posted December 20, 2011 Author Share Posted December 20, 2011 Thank you Quote Link to comment Share on other sites More sharing options...
BlackBox Posted December 20, 2011 Share Posted December 20, 2011 Thank you Happy to help. Quote Link to comment Share on other sites More sharing options...
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.