Short description
🚀 Assembly MText Label is an AutoCAD Civil 3D labeling utility that creates a dynamic MText field label linked directly to a selected Civil 3D Assembly object.
📌 The main benefit is faster Assembly annotation, fewer manual text edits, and automatic label updates when the Assembly name changes.
Command:
🧰 The user starts the tool, selects a Civil 3D Assembly in the drawing, then picks an insertion point for the generated label.
🔴 The exact command name is not specified in the provided code description, but the workflow is built around Assembly selection, ObjectId retrieval, FIELD expression creation, and MText insertion.
🏗️ Target platform: AutoCAD Civil 3D, using AutoCAD database objects, Civil 3D Assembly objects, dynamic fields, and annotation text.
Description:
Helper function: (if any)
- 🔍 Assembly selection logic – prompts the user to choose a valid Civil 3D Assembly entity from the active drawing.
- 🧩 ObjectId binding – retrieves the selected entity
ObjectIdso the generated field points to the correct drawing object. - 🧠 FIELD expression builder – creates an AutoCAD
FIELDexpression linked to the AssemblyNameproperty, with the option to adapt the expression toDisplayNameif required. - 📌 Insertion point workflow – asks the user to pick the exact location where the Assembly label should be placed.
- 📝 MText creation – creates an
MTextdatabase object and assigns the generated field expression as its text content. - 📐 Automatic text sizing – reads the current
TEXTSIZEsystem variable and applies a practical fallback height when needed. - 🔄 Dynamic update behavior – uses AutoCAD field evaluation so the label can reflect Assembly property changes after field updates.
Functionalities:
- 🚀 Create Civil 3D Assembly labels – quickly places an Assembly name label without typing the text manually.
- 🔍 Select an Assembly object – lets the user choose the Civil 3D Assembly directly in the drawing.
- 🧩 Link label to ObjectId – binds the text field to the real selected object instead of using static text.
- 📝 Generate dynamic MText – creates an
MTextlabel that contains a live AutoCAD field expression. - 📌 Pick custom placement point – allows precise manual placement of the annotation label.
- 📐 Apply automatic formatting – uses
TEXTSIZEfor readable text height and consistent drawing annotation. - 🔄 Update when Assembly name changes – supports dynamic field-based updates for better Civil 3D annotation control.
- 🔒 Reduce manual drafting errors – prevents mismatches between Assembly names and typed labels.
Result:
✅ The final result is a productivity-focused AutoCAD Civil 3D Assembly labeling tool that creates a dynamic MText field label connected to the selected Assembly object.
🟢 It improves drawing accuracy, speeds up annotation workflows, reduces manual text maintenance, and helps Civil 3D users keep Assembly labels synchronized with object properties.
Images, animations etc.
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="AssemblyLabel">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: AssemblyLabel</Bold>
<LineBreak/>
<Bold>Version: 1 Date: 25.09.2025</Bold>
<LineBreak/>
<LineBreak/>
<Hyperlink>AI</Hyperlink>
<LineBreak/>
<Bold>Description</Bold><LineBreak/>
This program allows the user to create an <Bold><Span Foreground="DarkRed">MText label</Span></Bold> that is automatically linked to a selected <Bold><Span Foreground="DarkRed">Civil 3D Assembly</Span></Bold> object.<LineBreak/>
<Bold>Main actions:</Bold><LineBreak/>
• The program prompts the user to <Bold><Span Foreground="DarkRed">select an Assembly object</Span></Bold> in the drawing.<LineBreak/>
• It retrieves the <Bold><Span Foreground="DarkRed">ObjectId</Span></Bold> of the selected entity and uses it to build a <Bold><Span Foreground="DarkRed">FIELD expression</Span></Bold>.<LineBreak/>
• The <Bold><Span Foreground="DarkRed">FIELD</Span></Bold> is bound to the Assembly’s <Bold><Span Foreground="DarkRed">Name</Span></Bold> property (or can be adjusted to <Bold><Span Foreground="DarkRed">DisplayName</Span></Bold>).<LineBreak/>
• The user is prompted to pick an <Bold><Span Foreground="DarkRed">insertion point</Span></Bold> for the label.<LineBreak/>
• An <Bold><Span Foreground="DarkRed">MText object</Span></Bold> is created at that location with the FIELD as its content.<LineBreak/>
• The <Bold><Span Foreground="DarkRed">text height</Span></Bold> is set automatically based on the current <Bold><Span Foreground="DarkRed">TEXTSIZE</Span></Bold> system variable (or a fallback value).<LineBreak/>
• The label will <Bold><Span Foreground="DarkRed">update dynamically</Span></Bold> if the Assembly name changes.<LineBreak/>
<Bold>Functionalities provided:</Bold><LineBreak/>
• <Span Foreground="Red">Entity selection</Span> → choose the Civil 3D Assembly.<LineBreak/>
• <Span Foreground="Red">ObjectId retrieval</Span> → ensures correct binding in FIELD expression.<LineBreak/>
• <Span Foreground="Red">FIELD generation</Span> → links label to Assembly property.<LineBreak/>
• <Span Foreground="Red">Point placement</Span> → user defines label location.<LineBreak/>
• <Span Foreground="Red">MText creation</Span> → adds FIELD as dynamic text.<LineBreak/>
• <Span Foreground="Red">Automatic formatting</Span> → height and width handled for readability.<LineBreak/>
• <Span Foreground="Red">Dynamic updates</Span> → text reflects property changes automatically.<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>
