[Search tip detail and code files using keywords, tip number, author name, etc ]
    For tip to function correctly, you must ensure that the downloaded file name matches the file name
    displayed in the Rename File To field. Please rename downloaded files when necessary.
Make New Objects with Existing Objects' Properties
Tip# 3935 By Kent Cooper On 17-Jul-2012
Rated By 1 users Downloaded : 1187
Categories : Object Properties, Match Properties, Linear Objects, Curved Objects
Software type : AutoCAD
Rename File To : MakeMore.LSP
This routine is very similar to the built-in AutoCAD command named AddSelected.

Frequent contributor Kent Cooper is back this month with another new and improved routine. Kent’s inspiration for this function is a 2008 Cadalyst CAD Tip from Mosad H. Elewa, titled "Make More Of The Same." The purpose of this routine is to allow you to create a new object in AutoCAD that's based on the properties of a selected object. For example, if you select a text entity, the Text command will be initiated with the properties of the selected text object (layer, style, etc.) set current so you can start drawing a new line of text with the same properties as the selected string. This routine is very similar to the built-in AutoCAD command named AddSelected, except that this routine has more options for certain objects. If you select a linear dimension, for example, you have the option to create a new dimension, a continued one, or a series of baseline dimensions. To get started, load the LISP file and type in the command MM. Pick any drawing object, and the command to draw that object will be launched. Kent authored this routine using AutoCAD 2004, so entity types newer than that are not supported; however, the properties of the selected object are still set current. This is a fairly complex routine, but as always, Kent’s code contains plenty of helpful comments and other tips.

Update, July 2012: The author provided an updated version of the tip; see comments as follows:

The noteworthy change is that it now works in noun-verb operation. If one object is pre-selected when the command name MM is typed in, it uses that object without asking the user to select something. If multiple objects are selected, it un-selects them and then asks the user to select one object as it did before (and of course still does when nothing is pre-selected).


Average Rating:

User comments
Comment by Cooper,Kent
Posted on 2012-07-18 10:47:03
A little further comment: AddSelected came along in a later version than this was written in, so for those like me with older versions that don't have that, this should be roughly equivalent, but even those with AddSelected may like the "more options for certain objects" mentioned. For entity types that can be drawn by different commands [e.g. LWPolylines] it offers all appropriate command choices, and can recognize certain characteristics of some objects [e.g. it can identify a Donut and offer that command as a default]. People with newer versions who are AutoLISP-capable can add sub-sections for entity types that it doesn't yet support.
Comment by Sherry,Stephen
Posted on 2014-09-12 06:11:05
Hi, awesome script. I create hatches based on hatches that are sometimes non associative and inside blocks) (see below). I was trying to get it to work by adding the line (setvar 'hpassoc 1) to make the new hatches associated with selected boundaries. Is it possible to get an update? Would it also be to much trouble to get the lisp to say. Have an option to get the properties from blocks like hatch pattern, line, etc?
Comment by Cooper,Kent
Posted on 2015-02-24 10:36:20
[Just noticed Comment 2....] To have it use your current HPASSOC setting instead of taking that of the selected Hatch pattern, put a semicolon at the beginning of the line (setvar 'hpassoc (*ed 97)), or you could even force it to always be 1 in case it isn't, by not adding the semicolon but changing that line to (setvar 'hpassoc 1). The nested-object part is harder. It would need to use (nentsel) to dig down to a nested object. It couldn't just use that outright, or you would never be able to Make More of a Block/Xref. I'll have to think about how to have it notice that the selected object is a Block/Xref, and ask whether the User wants that top-level object or the nested one it was picked on, but that's probably achievable.
Comment by Sherry,Stephen
Posted on 2015-05-08 07:27:36
Thanks for the consideration for the new feature. I tried the '(setvar 'hpassoc 1)'. It works when I use the BHatch method but not the Hatch method. I tried to add the '(setvar 'hpassoc 1)' after the line '((= typ "HATCH")' but no luck.
Comment by Huh,Chau
Posted on 2015-06-09 20:43:13
Kent, How would one go about adding leader user arrow styles to this lisp? Thanks.