Select all objecs of a type (Alignment Station Offset Label)

Hello, I have a routine in Dynamo where the only input is the selection of all “Alignment Station Offset Label” objects from the file, I would like to know if there is any way to obtain all these objects automatically, the “Objects Types” node or “All Objects of Type” didn’t seem to suit me or I’m trying to use them wrong. I also tried using QuickSelect.SelectSimilar" from the “ArkanceSystem”-package but since the labels can be on different layers, it didn’t work for me either

Currently I have the “Select Objects” node from Civil3DToolkit and select all Alignment Station Offset Label via Quick Select settings:

  • Apply to: Entire Drawing
  • Object Type: Alignment Station Offset Label
  • Operator: Select All

Hi and welcome

Oki, what is the purpose of the selection? What do you want to happen after selection of Alignment labels?
I mean, can you get all alignmnents and then get their Alignment labels?

Hello, Thank you!

My objective is to extract information from the Label itself, information such as X/Y position, text, alignment, style and things like that… After that, format this data and export it to a .csv file, currently this is already working as that I planned. However, I still have to manually select the objects.

I believe that as long as I get all the Alignment Station Offset Labels from the file, as objects, there is no problem with the way I get them

I would send the dwg and dynamo file that I’m using but I can’t yet because I’m a new user

Can you reading this

But you can not get data a value of label text

Hello, I had read this post and tried to use it… but there were some errors doing so, the code itself reads only one alignment at a time apparently and even selecting just one at a time, the type of object found is different from what I needed

I don’t know how to put this in a better way, I’m new to using dynamo and I’m still learning… So I’m sorry for any inconvenience

I think the issue is that there is no function to get the labels automatic. I tried to work it out using nodes but couldn’t find a way how to deal with it.

Alignment Station Offset Labels are not easy to get to with OOTB and Camber nodes.
Here’s a python solution

import clr
import traceback

clr.AddReference("AcDbMgd")
clr.AddReference("AeccDbMgd")

# Import references from AutoCAD
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *

# Import references from Civil3D
from Autodesk.Civil.DatabaseServices import *

adoc = Application.DocumentManager.MdiActiveDocument

alignments = IN[0]  # Use Document.Current -> Alignments Node

with adoc.LockDocument():
    with adoc.Database as db:
        with db.TransactionManager.StartTransaction() as t:
            try:
                lids = []
                for alignment in alignments:
                    lids.extend(alignment.InternalDBObject.GetAlignmentLabelIds())
                if lids:
                    labels = [t.GetObject(lid, OpenMode.ForRead) for lid in lids]
                    OUT = [(label.DisplayName, label.StyleName, label.AnchorInfo.Location) for label in labels]
                else:
                    OUT = None
            except:
                OUT = traceback.format_exc()
            t.Commit()

2 Likes

7

2 Likes