How to drag a label?

Hello,
I set a tube label but now I want to drag it, move it and rotate it.
I’m trying for “.DraggedOffset” which the API promises to set a new point, but it doesn’t work.



image

It looks like you’ve opened the label as ForRead?

I created the Pipe Label with:
PipeLabel = Autodesk.Civil.DatabaseServices.PipeLabel.Create(Pipe_Ids[1],0.5,PipeLabelStyles_Ids[0])

And it returned me the PipeLabel ID

Then, used Label=TS.GetObject(t,PipeLabel,OP.ForRead) to get the civil object, so I could use it as a PipeLabel object (and then drag it, move it, etc). But unfortunatelly it didn’t work.

Right, so wouldn’t you need to open the object as ForWrite to modify the property?

1 Like

Ok, I changed it to ForWrite, but it still didn’t drag the label.

I don’t know if “LabelLocation.Add” is the correct way to drag it. I used it because from what I found in the API Reference Guide, the “DraggedOffset” was the more obvious property to do what I wanted. Reading the syntax, it is stated that it’s an obsolete attribute, and they recommend “Use property LabelLocation instead.”

Here is the link to the LabelGroupSubEntity Members: Help

I uploaded a video showing what I want to do. I want to write a script that could allow me to drag a label and place it in a known place (following a vector, point, etc)

I’m not sure
Use ResetLocation
before line 92 With the item opened
In one picture

1 Like

Is it possible to share
Python Script
to work on it

1 Like

Hi, this is the example I’m trying to put as labels and then drag them.
DES_229_P6_BMD_REDE_B_R2.dwg (3.4 MB)
SetLabel.dyn (9.0 KB)

I saw your other post and made the similar code and I got it! Thank you very much!!!

The post for everyone: https://forum.dynamobim.com/t/draggedoffset-property-label/65826

2 Likes

@ andre.demski
Will you be able to share the script?

@hosneyalaa @manrajan.kalimuthu @andre.demski check out Camber, my new package for Civil 3D. There are nodes to set label dragged offset.

Label

4 Likes

Nice! I’m glad you guys developed things like that! Now I’m working with Pressure Networks, it’s all very recent and there are no things we can do via the API, like create a fitting.