Short description
Purpose
Create a copied Civil 3D structure at each selected COGO point, positioned and elevated from the point data.
Scope
Works directly with AeccDbStructure and AeccDbCogoPoint objects using COM, without AeccXUiPipe or AeccPipeApplication dependencies.
Command:
Command name
CogoPoints2Structures
How to run
Load the LISP, then run: CogoPoints2Structures
Description:
What it does
- Select one TEMPLATE structure (must be AeccDbStructure).
- Select multiple COGO points (filter: AECC_COGO_POINT).
- For each selected COGO point, copy the template structure, move it to the point location, and set the new structure rim elevation to the point elevation.
Helper function: (if any)
Local error handler
- *error* restores CMDECHO to its prior value (prevents command echo from staying disabled).
- Suppresses printing for normal cancel and quit messages; prints other errors as Error: ….
- Used both on failure paths and for clean exit to ensure environment cleanup.
Functionalities:
Main steps
- Loads COM support via vl-load-com.
- Saves current CMDECHO and sets it to 0 for quiet execution, then restores it on exit.
- Validates the selected template by checking (vla-get-ObjectName obj) equals AeccDbStructure.
- Collects COGO points using a selection set filter: ((0 . “AECC_COGO_POINT”)).
- For each point: reads Location (3D point) and Elevation.
- Copies the template structure with (vla-Copy tmplStruct).
- Moves the new structure to the point using (SetLocation loc).
- Sets RimElevation to the point elevation using (vlax-put newStruct ‘RimElevation ptElev).
Result:
User-visible outcomes
- If no valid template structure is selected: prints “No valid template structure selected.” and exits cleanly.
- If no COGO points are selected: prints “No COGO points selected.” and performs no changes.
- On success: prints a completion message like “Created N structures from template.” where N equals the number of selected points.
- All runs restore CMDECHO; unexpected failures print Error: ….
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="CogoPoints2Structures">
<src:RibbonToolTip.ExpandedContent>
<StackPanel>
<TextBlock Background="AntiqueWhite" TextAlignment="Left">
<Bold>Function Syntax: CogoPoints2Structures</Bold>
<LineBreak/>
<Bold>Version: 1 Date: 04.12.2025</Bold>
<LineBreak/>
<LineBreak/>
<Hyperlink>AI</Hyperlink>
<LineBreak/>
<Bold>Description</Bold><LineBreak/>
This program allows the user to automatically create copies of a template Civil 3D Structure and place them at the locations of selected COGO Points, matching each structure’s Rim Elevation to the point’s Elevation.<LineBreak/><LineBreak/>
<Bold>Main Functionalities</Bold><LineBreak/>
• The user is prompted to select a template structure (<Bold><Run Foreground="DarkRed">AeccDbStructure</Run></Bold>).<LineBreak/>
• The routine validates that the selected object truly is an <Bold><Run Foreground="DarkRed">AeccDbStructure</Run></Bold>.<LineBreak/>
• The user then selects multiple COGO Points (<Bold><Run Foreground="DarkRed">AeccDbCogoPoint</Run></Bold>) to define where new structures will be placed.<LineBreak/>
• For each COGO Point, the routine performs the following actions:<LineBreak/>
• Creates a copy of the template structure using <Bold><Run Foreground="Red">vla-Copy</Run></Bold>.<LineBreak/>
• Retrieves the point's Location and Elevation using <Bold><Run Foreground="Red">vlax-get</Run></Bold>.<LineBreak/>
• Moves the copied structure to the COGO Point using <Bold><Run Foreground="Red">SetLocation</Run></Bold>.<LineBreak/>
• Sets the structure's RimElevation equal to the COGO Point's Elevation with <Bold><Run Foreground="Red">vlax-put</Run></Bold>.<LineBreak/>
• When complete, the routine reports the number of structures created.<LineBreak/><LineBreak/>
<Bold>Important Implementation Details</Bold><LineBreak/>
• COM is loaded using <Bold><Run Foreground="Red">vl-load-com</Run></Bold>.<LineBreak/>
• <Bold><Run Foreground="DarkRed">CMDECHO</Run></Bold> is temporarily disabled to keep the command line clean.<LineBreak/>
• A custom error handler restores settings and avoids abnormal termination.<LineBreak/>
• Only AeccDbStructure objects are accepted as templates.<LineBreak/>
• Only AECC_COGO_POINT objects are accepted for placement locations.<LineBreak/><LineBreak/>
<Bold>Workflow Summary</Bold><LineBreak/>
• User selects a template structure.<LineBreak/>
• User selects a set of COGO Points.<LineBreak/>
• The routine loops through all selected points.<LineBreak/>
• For each point:<LineBreak/>
• Template is copied.<LineBreak/>
• Copy is moved to point location.<LineBreak/>
• Rim elevation is synchronized with COGO Point elevation.<LineBreak/>
• Confirmation message displays how many structures were created.<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>
Additional info:
Based on / Source code:
Open Website
Share this page:
Subscribe
Login
0 Comments
Oldest
