This is Lee Ambrosius's Typepad Profile.
Join Typepad and start following Lee Ambrosius's activity
Join Now!
Already a member? Sign In
Lee Ambrosius
I am a nut when it comes to AutoCAD and programming.
Interests: running, cad, spending time with friends and family., anything that deals with technology
Recent Activity
Without a specific use case to design the sample code around, quickly created a very generic example that could be refined a number of ways. The sample code looks for text the text value of "123" and if found, it will change the Visibility State of blocks named "Trees - Imperial". I built the example around Single-line and Multiline text, but it could be done for block attribute values as well. Good luck and let me know if you have any specific questions. ;; Looks for text objects with 123 in them, and if it finds the dynmaic block ;; "Trees - Imperial" it changes the visibility state to Shrub (Plan). (defun c:blockFlip ( / ssAll nCnt nTextPos lBlocks lText oEnt lEd sTextCompare) (setq ssAll (ssget "X") nCnt 0 nTextPos nil lBlockRefs nil lTextObjs nil sTextCompare "123" ) ;; Step through all objects in a drawing and look for the text objects and block references (while (> (sslength ssAll) nCnt) (setq oEnt (ssname ssAll nCnt) lEd (entget oEnt) ) ;; Create two lists; one with text objects (single-line and multiline) and one with block references ;; Note: Could have also done multiple (ssget) statements with a filter (cond ((or (= (cdr (assoc 0 lEd)) "TEXT")(= (cdr (assoc 0 lEd)) "MTEXT")) (if (= lTextObjs nil) (setq lTextObjs (append (list oEnt))) (setq lTextObjs (append lTextObjs (list oEnt))) ) ) ((= (cdr (assoc 0 lEd)) "INSERT") (if (= lBlockRefs nil) (setq lBlockRefs (append (list oEnt))) (setq lBlockRefs (append lBlockRefs (list oEnt))) ) ) ) (setq nCnt (1+ nCnt)) ) ;; Step through all text objects and look for text strings that match the value of sTextCompare (foreach oEnt lTextObjs (progn (setq lEd (entget oEnt)) (if (= (cdr (assoc 0 lEd)) "TEXT") (setq nTextPos (vl-string-search sTextCompare (strcase (getpropertyvalue oEnt "TextString")))) (setq nTextPos (vl-string-search sTextCompare (strcase (getpropertyvalue oEnt "Text")))) ) ;; If a match to text string was found, step through the blocks (if (/= nTextPos nil) ;; If the block is named "Trees - Imperial" one of the sample dynamic block son the tool palette ;; and the block is indeed a dynamic block, change its viibility style (if (and (= (getpropertyvalue ent "BlockTableRecord/Name") "Trees - Imperial") (= (getpropertyvalue ent "IsDynamicBlock") 1) ) (progn (setq lDynProps (vlax-safearray->list (vlax-variant-value oDynProps))) (foreach oDynProp lDynProps (vla-put-Value oDynProp "Shrub (Plan)") ) ) ) ) ) ) (princ) )
The DATALINK object isn't documented currently in the DXF Reference, the requests to document this information comes from the team that implements the feature. The Datalink feature pre-dates my time as the AutoCAD API Writer, so I don't want to speculate why it wasn't documented. I will add this to my list of things to look into for a future update, no promises as to when it might be documented though. DATALINK objects are stored in the "ACAD_DATALINK" named dictionary and can be obtained with the DICTSEARCH AutoLISP function among other APIs. (dictsearch (namedobjdict) "ACAD_DATALINK") Once you have the entity name of the "ACAD_DATALINK" dictionary, you can then get the Datalinks that are defined in the drawing. (entget (cdr (assoc 360 (dictsearch (namedobjdict) "ACAD_DATALINK" T)))) ((-1 . ) (0 . "DATALINK") (5 . "203") (102 . "{ACAD_REACTORS") (330 . ) (102 . "}") (330 . ) (100 . "AcDbDataLink") (1 . "AcExcel") (300 . "") (301 . "Data Link\nTest Datalink\nC:\\Users\\ambrosl\\Documents\\chair.xls\nLink details: Entire sheet: Sheet1") (302 . "C:\\Users\\ambrosl\\Documents\\chair.xls!Sheet1") (90 . 2) (91 . 68943873) (92 . 1) (170 . 2017) (171 . 12) (172 . 11) (173 . 16) (174 . 11) (175 . 20) (176 . 0) (177 . 1) (93 . 0) (304 . "") (94 . 1) (330 . ) (360 . ) (305 . "CUSTOMDATA") (1 . "DATAMAP_BEGIN") (90 . 3) (300 . "ACEXCEL_CONNECTION_STRING") (301 . "DATAMAP_VALUE") (93 . 2) (90 . 4) (1 . "C:\\Users\\ambrosl\\Documents\\chair.xls!Sheet1") (94 . 0) (300 . "") (302 . "") (304 . "ACVALUE_END") (300 . "ACEXCEL_SOURCEDATE") (301 . "DATAMAP_VALUE") (93 . 2) (90 . 8) (92 . 16) (310 . "E0070900030007000A00110021000000") (94 . 0) (300 . "") (302 . "") (304 . "ACVALUE_END") (300 . "ACEXCEL_UPDATEOPTIONS") (301 . "DATAMAP_VALUE") (93 . 2) (90 . 1) (91 . 68943873) (94 . 0) (300 . "") (302 . "") (304 . "ACVALUE_END") (309 . "DATAMAP_END")) What information are you specifically looking for? Sincerely, Lee
AU 2004 seems like a long time ago, but it was the first year in which I presented at Autodesk University and I was a nervous wreck; still even Today I would classify myself as a nervous speaker. The perfectionist... Continue reading
Posted Nov 20, 2017 at HyperPics: Beyond the UI
While the AutoCAD 2018 product was released only about a month ago, the first developer documentation content update has been released. In recent years, content updates have been released once in the Summer and Fall months. However, we are going... Continue reading
Posted Apr 17, 2017 at HyperPics: Beyond the UI
Starting with AutoCAD 2018-based products, AutoLISP programs that utilize the members defined by the IAcadFileDependencies and IAcadFileDependency classes in the AutoCAD ActiveX/COM library must be updated as a result of the classes being removed. The AutoLISP functions that are affected... Continue reading
Posted Apr 4, 2017 at HyperPics: Beyond the UI
AutoCAD 2018 marks for me the 11th product release that I worked on, it is hard to believe that I started working with the AutoCAD team about 12 years ago now (2 years as a consultant and going on 10... Continue reading
Posted Mar 28, 2017 at HyperPics: Beyond the UI
Image
Prior to the AutoCAD 2018-based products and the ObjectARX 2018 SDK, the aced.h header file implicitly included <windows.h>. When building ObjectARX applications for AutoCAD 2018-based products on Windows, you must now include <windows.h> in one of your C++ source files... Continue reading
Posted Mar 28, 2017 at HyperPics: Beyond the UI
Picking up a project that you are passionate about can be very easy, but it can also be a burden at the same time. I was given the opportunity just over 4 years ago to lead the AutoCAD developer documentation,... Continue reading
Posted Mar 21, 2017 at HyperPics: Beyond the UI
The AutoCAD Developer Documentation survey has been posted twice over the past 4 years, but the results of those surveys and how those responses were used hasn't really been shared. Because we value the input from our communities, I am... Continue reading
Posted Mar 20, 2017 at HyperPics: Beyond the UI
The AutoLISP programming language supports some basic debugging techniques that can be utilized to help troubleshoot problems within a custom program. Displaying messages or values during the execution of a custom program can be beneficial in identifying the statement that... Continue reading
Posted Mar 9, 2017 at HyperPics: Beyond the UI
Debugging AutoLISP programs is "A Zen like Experience," said no one ever... Although, I have tried to convince a number of people that it is very a calming and soothing activity over the years. There are a number of different... Continue reading
Posted Mar 2, 2017 at HyperPics: Beyond the UI
Why calculate elapsed time or differences in time you might be wonder? There are primarily two reasons to do this: Determine the time it took to complete a task; for calculating cost savings or Return on Investment (ROI) Generate a... Continue reading
Posted Feb 27, 2017 at HyperPics: Beyond the UI
Needing to populate a title block or stamp a drawing with the current date/time is a very common task in the AutoCAD product along with determining the time it might have taken to execute a custom program for return of... Continue reading
Posted Feb 22, 2017 at HyperPics: Beyond the UI
Recently, I mentioned that the CDATE and DATE system variables no longer store time down to milliseconds. In addition to those system variables, the following system variables are now accurate to the nearest second starting with AutoCAD 2017, whereas earlier... Continue reading
Posted Feb 21, 2017 at HyperPics: Beyond the UI
Upgrading from AutoCAD 2015 or earlier to AutoCAD 2016 or AutoCAD 2017? If you are in the process of upgrading to a recent release of an AutoCAD-based product, you will want to check the scripts, action macros, and custom programs... Continue reading
Posted Feb 16, 2017 at HyperPics: Beyond the UI
In AutoCAD 2017-based products, the CDATE and DATE system variables no longer store the current time down to the current millisecond which if you are getting the current date or time might not be a deal breaker for your custom... Continue reading
Posted Feb 14, 2017 at HyperPics: Beyond the UI
Needing to populate a title block or stamp a drawing with the current date/time is a very common task in the AutoCAD product along with determining the time it might have taken to execute a custom program for return of... Continue reading
Posted Feb 14, 2017 at HyperPics: Beyond the UI
Update - Sample code was revised to include some additional error handling and return some basic error messages in the case of nil being passed to the function. When working with file paths in AutoCAD, it is common that you... Continue reading
Posted Feb 6, 2017 at HyperPics: Beyond the UI
Hello Gareth, The AutoCAD Map 2017 ObjectARX SDK has been posted to the URL you mentioned; my understanding is only 64-bit is supported even though the page lists both 32- and 64-bit. I might be wrong as I was parsing the email rather quickly. Thanks for bringing this to my attention, even though it wasn't doc, I am always happy to communicate issues onto others when I can. Sincerely, Lee
I am not aware as to why the AutoCAD Map 2017 Object SDK hasn't been posted yet to the site. I did send an email about this issue, but will not hear much other than maybe a reply as to why I am sending emails during my sabbatical. :) If I hear anything, I will add a new comment.
Sorry about the delay... I am currently on sabbatical, I will try and take a look at this tonight. You might have to get the actual MText object in the cell and change its color directly.
I inquired about the ObjectARX 2017 Wizard 3-4 weeks ago and there was some talk in updating it, but a technical problem was encountered to my understanding and that is why there was a new version created for Managed .NET and not ObjectARX. The code for the ObjectARX Wizard is on GitHub (https://github.com/Developer-Autodesk/ObjectARX-Wizards) if you want to try and make the changes yourself. I am sure once the new one has been built though, it will be posted with the others at http://www.autodesk.com/developautocad. I will do some following up on the wizard if the new one hasn't been posted by the time I get back from sabbatical.
Image
As a developer, the one thing that is almost as important to me as my development environment is the documentation for the libraries I plan on using. Documentation is broken up into two different pieces of information: reference and concepts.... Continue reading
Posted Mar 31, 2016 at HyperPics: Beyond the UI
There is a known issue that is currently being looked into that was fixed in a previous release and has since resurfaced in AutoCAD 2017. There are two known workarounds at the moment to allow debugging with Visual Studio: •Tools > Options > Debug-General > Use Managed Compatibility Mode •Project > Properties > Debug Enable native code debugging Both these options do result in the disabling of Edit & Continue.
I debug my projects without Edit & Continue, mainly because much of what I do is across multiple releases of AutoCAD and versions of VS. I do have the same problem with Edit & Continue though and have reached out to the SWD team. This problem seems to be similar to what was happening with VS2013 and earlier releases of AutoCAD: http://through-the-interface.typepad.com/through_the_interface/2013/11/debugging-autocad-using-visual-studio-2013.html I will post an update when I get any information to share.