[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
5
Rated By 1 users Downloaded : 243
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:
5


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?


Log In