Short description
Command:
Description:
Helper function: (if any)β
Functionalities:
Result:
Images, animations etc.
Log in
XAML code:
<ResourceDictionary
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:src="clr-namespace:Autodesk.Windows;assembly=AdWindows">
<src:RibbonToolTip x:Key="NCopyExtra">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: NCopyExtra</Bold>
<LineBreak/>
<Bold>Version: 1 Date: 13.10.2025</Bold>
<LineBreak/>
<LineBreak/>
<Hyperlink>AI+https://forums.autodesk.com/t5/visual-lisp-autolisp-and-general/how-to-ncopy-multiple-at-same-place-or-pause-the-ncopy-command/td-p/10932882</Hyperlink>
<LineBreak/>
<Bold>Command name</Bold><LineBreak/>
<Run>NCopyExtra (type </Run><Run Foreground="DarkRed">NCopyExtra</Run><Run> at the AutoCAD command line)</Run><LineBreak/>
<LineBreak/>
<Bold>Description</Bold><LineBreak/>
<Run>This routine copies a selected object and places the new copy onto a </Run><Run Foreground="DarkRed">local layer name</Run><Run> (xref prefix removed), while preserving the original object geometry and matching the layer properties (color, linetype, lineweight) from the xref layer.</Run><LineBreak/>
<LineBreak/>
<Bold>User interaction</Bold><LineBreak/>
<Run>β’ The user is repeatedly prompted to </Run><Run Foreground="DarkRed">select an object to copy</Run><Run>.</Run><LineBreak/>
<Run>β’ The routine continues in a loop until the user </Run><Run Foreground="DarkRed">cancels selection</Run><Run> (for example Esc).</Run><LineBreak/>
<LineBreak/>
<Bold>High-level workflow</Bold><LineBreak/>
<Run>β’ Accesses the current AutoCAD document and its layer table using </Run><Run Foreground="DarkRed">ActiveX (VLA and VLAX)</Run><Run>.</Run><LineBreak/>
<Run>β’ Reads the selected object entity data, including its </Run><Run Foreground="DarkRed">layer (group code 8)</Run><Run>.</Run><LineBreak/>
<Run>β’ If the layer is an xref layer (contains </Run><Run Foreground="DarkRed">|</Run><Run>), it trims the prefix and keeps only the part after the separator.</Run><LineBreak/>
<Run>β’ Creates a new entity from the original entity list using </Run><Run Foreground="DarkRed">entmakex</Run><Run>.</Run><LineBreak/>
<Run>β’ Applies the correct transformation matrix from the selection pick data so the copy appears in the correct position and orientation using </Run><Run Foreground="DarkRed">vla-transformby</Run><Run>.</Run><LineBreak/>
<Run>β’ Retrieves the </Run><Run Foreground="DarkRed">xref layer object</Run><Run> (full layer name including xref prefix) from the Layers collection.</Run><LineBreak/>
<Run>β’ Ensures the </Run><Run Foreground="DarkRed">local trimmed layer</Run><Run> exists, creating it if needed.</Run><LineBreak/>
<Run>β’ Copies key properties from the xref layer to the local layer (color, linetype, lineweight).</Run><LineBreak/>
<Run>β’ Assigns the new entity to the local trimmed layer.</Run><LineBreak/>
<LineBreak/>
<Bold>Functionalities</Bold><LineBreak/>
<Run>β’ Object duplication that preserves the original entity definition using </Run><Run Foreground="DarkRed">entget</Run><Run> and </Run><Run Foreground="DarkRed">entmakex</Run><Run>.</Run><LineBreak/>
<Run>β’ Automatic xref layer name cleanup (</Run><Run Foreground="DarkRed">_XREF|LayerName</Run><Run> becomes </Run><Run Foreground="DarkRed">LayerName</Run><Run>).</Run><LineBreak/>
<Run>β’ Automatic creation of the destination layer if it does not exist (adds the trimmed name to the local drawing).</Run><LineBreak/>
<Run>β’ Layer standards carry-over from the xref layer to the local layer:</Run><LineBreak/>
<Run> β’ <Run Foreground="DarkRed">Color</Run> is copied.</Run><LineBreak/>
<Run> β’ <Run Foreground="DarkRed">Linetype</Run> is copied.</Run><LineBreak/>
<Run> β’ <Run Foreground="DarkRed">Lineweight</Run> is copied.</Run><LineBreak/>
<Run>β’ Ensures the copied entity is placed onto the </Run><Run Foreground="DarkRed">trimmed local layer</Run><Run> via </Run><Run Foreground="DarkRed">vla-put-layer</Run><Run>.</Run><LineBreak/>
<LineBreak/>
<Bold>Important commands and calls highlighted</Bold><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">nentselp</Run> β interactive selection that also provides transformation context (used for correct placement).</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">entget</Run> β reads the original entity definition.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">entmakex</Run> β creates the new copied entity in the drawing database.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">vla-transformby</Run> β applies the selection matrix so the new entity matches the originalβs position and orientation.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">vla-item</Run> and <Run Foreground="DarkRed">vla-add</Run> β reads and creates layers in the drawing.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">vla-put-Color</Run>, <Run Foreground="DarkRed">vla-put-LineType</Run>, <Run Foreground="DarkRed">vla-put-Lineweight</Run> β transfers layer properties.</Run><LineBreak/>
<Run>β’ <Run Foreground="DarkRed">vla-put-layer</Run> β assigns the copied entity to the cleaned layer name.</Run><LineBreak/>
<LineBreak/>
<Bold>Operational notes and limitations</Bold><LineBreak/>
<Run>β’ This routine depends on </Run><Run Foreground="DarkRed">Visual LISP ActiveX</Run><Run>, so include </Run><Run Foreground="DarkRed">(vl-load-com)</Run><Run> before running it.</Run><LineBreak/>
<Run>β’ It copies the raw entity data; complex or proxy entities may behave differently depending on object type and available DXF data.</Run><LineBreak/>
<Run>β’ The xref layer must exist in the drawing layer table under its full name for the property copy step to succeed.</Run><LineBreak/>
</TextBlock>
<Grid>
<Image Source="PNG" Stretch="Uniform"/>
</Grid>
<Grid>
<MediaElement
Source="GIF"
Stretch="Uniform"
Visibility="Visible"/>
</Grid>
</StackPanel>
</src:RibbonToolTip.ExpandedContent>
</src:RibbonToolTip>
</ResourceDictionary>

Leave a Reply
You must be logged in to post a comment.