Excel input to MLeader-Table

Hello everyone,

I am trying to convert inputs coming from an Excel file into a CogoPoint group with a Label assigned with format table. Something like this:
image

I have been trying to modify the Label style of the CogoPoints and I saw that it is possible to add the number of texts that you want:


But as you can see, the width of the columns are not aligned and I did not find in Dynamo any node to insert that Text coming from Excel inputs.

Being said that, I have been thinking about another workaround by creating a CogoPoint Label style invisible (NoDisplay) and then create a MLeader tag assigned to that object.



With this approach, it seems it is not possible to get different words in different rectangles either…

Last try I tried to create a Civil 3D table which allows you to create the number of columns & cells that you want but I did not get to create the “pointing arrow” as the MLeader entity has.

Does anyone know any other approach to get this task done?

Thank you so much,

I find another way that I am gonna test it out. Create a block with the attributes that I should insert in as a “table” and create a MLeader with that block. I hope I could modify the Block-MLeader attributes from Dynamo.

There are nodes for this in Camber.

1 Like

Awesome @mzjensen !

I saw you gave some updates on Camber v2.0.0. and Civil 3D versions.

I will install one of the versions you mention there and I will have a look at it. One more query, do you know if it is possible to change the color of one Tag value? I need to put in red if a value is higher than X.

Regards,

1 Like

There isn’t anything that comes to mind for that. Seems like you would have to edit the objects within the block definition in order to do that, which would change them for all of the block references within the MLeaders. So it wouldn’t be unique.

if
You want to add text to LabelStyle points as it is in the attached image
May this page help you?

https://help.autodesk.com/view/CIV3D/2022/ENU/?guid=GUID-5C8D107C-8E28-49F9-8B3A-84F0BB87F77B

But change this line

ObjectId lineComponentId = oLabelStyle.AddComponent("New Line Component", LabelStyleComponentType.Line);

ObjectId lineComponentId = oLabelStyle.AddComponent("New TEXT", LabelStyleComponentType.TEXT);

Capture

Hi @hosneyalaa . That it is but not only add the text. It should be possible to create a “rectangle boundary” per each text and be able to put some texts in red:
image

How can you use the code line you posted before? just copy and paste it in a code block?

thank you.

Maybe
The problem is the size of the rectangle according to the text

So, use the block WITH attributes

Well, actually that is probably not an issue cause I can insert blank gaps in those values which are shorter in order to get all the rectangles with the same size.

Is that text editable in Dynamo?

YES

READING WELL THIS ALL

def set_label_component(labelId,compName,value):
	
	global adoc
	global editor
	global civdoc
	
	names=[]
	
	with adoc.LockDocument():
	    with adoc.Database as db:
	        with db.TransactionManager.StartTransaction() as t:
				label = t.GetObject(labelId,OpenMode.ForWrite)
				# Get text components
				comps = label.GetTextComponentIds()
				for id in comps:
					comp = t.GetObject(id, OpenMode.ForWrite)
					names.append(comp.General.Name)
				compId = comps[names.index(compName)]
				label.SetTextComponentOverride(compId,value)
				t.Commit()
	return label

Thank you so much @hosneyalaa . I will have a look at it but my Python knowledge is quite limited. I may ask for some support though.

I’m not sure
I have not tried it before
This could work for you

Hi @JMCiller
Why did you delete this post, your idea is good Attach a dynamo file for this idea and an excel file for example let’s work on it

There are nodes in Camber for setting text component overrides in labels.

Perhaps color by block and change the block color from by layer to something else if a given condition is met?

1 Like

Hi @hosneyalaa ,

I decided to remove it as I found out another way to do it. I will post my final outcome to receive your feedback or to tell me other workarounds to get a better result tomorrow.

I am gonna do it with CogoPoints, creating a PropertySet for each CogoPoint and modifying labels. However, as some labels should have some texts in red, I cannot just take the same style for every CogoPoint. I will have to create a style for those texts which are sometimes red.

I will keep you posted.

Regards,

1 Like

in Camber v2.0.0 or previous version which works with C3D 2021?

All versions. I’m not at my PC now but can share some screenshots later if that would be helpful?

Hi @mzjensen, @hosneyalaa and @jacob.small ,

I tried to make my workaround work and I faced some unexpected issues.

First of all, I created a PropertySet for my CogoPoints via Dynamo and I set the values:

Then, I create a new Point Label Style to view the parameters that I already created.

You will see in my first screenshot that the table does not have the same width for all parameters. For that reason, in my Dynamo script, I have included blank spaces " " to match the longest attribute value. You can see here in the Pset that the blank spaces have been inserted:


The first issue that I have is that the blank spaces are not inserted in the Text Component Editor when are placed at the end of the attribute:

Second issue, @mzjensen , I cannot find in the Camber package the input for the labels
to set the text later on. Do the nodes work with CogoPoints labels? Can the color of any specific parameter (text) be modified with your nodes?

Please, find attached the DWG file in case someone wants to have a look at it.

Thank you so much.
Drawing1.dwg (934.0 KB)

1 Like

Another workaround that I tried with your nodes @mzjensen is the following.

I created a new MLeader style based on a block.

Then, I created a MLeader tag by point with a block that has parameter values to define:


With Camber nodes I can modify Prompt & Tag but I cannot find the node to set the Values:

Since I did not find the SetValue node in Camber package, I saw in Civil3DToolkit that it is possible to assign values to a block but it is not working for me as you can see in the C3D modelspace, the values did not change:


Hope someone could give me a solution! Thank you again.