# DraggedOffset Property LABEL

**URL:** https://forum.dynamobim.com/t/draggedoffset-property-label/65826
**Category:** Civil 3D
**Tags:** share
**Created:** [July 5, 2021, 7:41am UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826 "2021-07-05T07:41:36Z")
**Posts on this page:** 14
**Page:** 1

<div class="post-metadata">

### Author: ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)
#### Post date: [July 5, 2021, 7:41am UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/1 "2021-07-05T07:41:36Z")

</div>

This is an example of DraggedOffset Property LABEL

Thanks everyone for the help  
I hope to make a follow-up to accept several AECC\_STRUCTURE\_LABEL  
It works with all LABELS

Thank

![Q1AAA](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/f/7fb72f337334d37a0b8aab410d8ef112e2e81218.gif)

---

<div class="post-metadata">

### Author: ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)
#### Post date: [July 5, 2021, 7:42am UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/2 "2021-07-05T07:42:28Z")

</div>

Python Script

```auto
import clr
#forum.dynamobim.com/t/create-corridor-surface-python/49010/8
# Add Assemblies for AutoCAD and Civil 3D APIs
clr.AddReference('acmgd')
clr.AddReference('acdbmgd')
clr.AddReference('accoremgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('AeccPressurePipesMgd')
clr.AddReference('acdbmgdbrep')
clr.AddReference('System.Windows.Forms')
clr.AddReference('Civil3DNodes')

# Add standard Python references
import sys
sys.path.append('C:\Program Files (x86)\IronPython 2.7\Lib')
import os
import math

# Add references to manage arrays, collections and interact with the user
from System import *
from System.IO import *
from System.Collections.Specialized import *
from System.Windows.Forms import MessageBox

# Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class
import Autodesk.AutoCAD.ApplicationServices.Application as acapp

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

# Import references for Civil 3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

# Import references for Dynamo for Civil 3D
from Autodesk.Civil.DynamoNodes import Alignment as DynAlignment

adoc = acapp.DocumentManager.MdiActiveDocument
ed = adoc.Editor
civdoc = CivilApplication.ActiveDocument

#SS= IN[0]
XX= IN[1]
YY= IN[2]

i = 0
DynamoProfileView = IN[0]

with adoc.LockDocument():

    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
    
            bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
            btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
            

            cor = t.GetObject(DynamoProfileView[0], OpenMode.ForWrite)
            BX= cor.LabelLocation.X
            BY= cor.LabelLocation.Y
            #cor = t.GetObject(IN[0], OpenMode.ForWrite)
            cor.UpgradeOpen()
            cor.LabelLocation = Point3d(BX + XX, BY + YY, cor.LabelLocation.Z)
            

            
            t.Commit()                                           
#return

#XX= IN[0]
#YY= IN[1]

# Assign your output to the OUT variable.

```

[DraggedOffset Property LABEL FINAL TO FORM 01.dyn](https://forum.dynamobim.com/uploads/short-url/cOb7vbFbunDVQqF8A2fHeap7u6F.dyn) (11.6 KB)

---

<div class="post-metadata">

### Author: ![Tiago.Caldeira](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/tiago.caldeira/32/113678_2.png) [@Tiago.Caldeira](https://forum.dynamobim.com/u/Tiago.Caldeira)
#### Post date: [July 6, 2021, 12:30pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/3 "2021-07-06T12:30:41Z")

</div>

Fantastic post. Thanks mate!!!

---

<div class="post-metadata">

### Author: ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)
#### Post date: [July 6, 2021, 1:58pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/4 "2021-07-06T13:58:19Z")

</div>

[quote=“hosneyalaa, post:2, topic:65826”]

```auto
with adoc.LockDocument():

    with adoc.Database as db:

        with db.TransactionManager.StartTransaction() as t:
    
            bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
            btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
            

            cor = t.GetObject(DynamoProfileView[0], OpenMode.ForWrite)
            BX= cor.LabelLocation.X
            BY= cor.LabelLocation.Y
            #cor = t.GetObject(IN[0], OpenMode.ForWrite)
            cor.UpgradeOpen()
            cor.LabelLocation = Point3d(BX + XX, BY + YY, cor.LabelLocation.Z)
            

            
            t.Commit()                                           
#return

```

Can you help writing the code as a function?  
To work on multiple LABELS  
As in dynamo  
Thank you

---

<div class="post-metadata">

### Author: ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)
#### Post date: [July 6, 2021, 4:58pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/5 "2021-07-06T16:58:22Z")

</div>

Hi @hosneyalaa

> [@hosneyalaa](#):
>
> help writing the code as a function?

Is this what you need?

![Move Label](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/7/b/7b1b69ed7df4d9bb47dbfb552b3aa7426007b4bb.gif)

---

<div class="post-metadata">

### Author: ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)
#### Post date: [July 6, 2021, 5:09pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/6 "2021-07-06T17:09:16Z")

</div>

Hello @Kulkul  
Yes, this is what I want  
Is it possible to share the file?

---

<div class="post-metadata">

### Author: ![Kulkul](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/kulkul/32/49801_2.png) [@Kulkul](https://forum.dynamobim.com/u/Kulkul)
#### Post date: [July 6, 2021, 5:46pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/7 "2021-07-06T17:46:22Z")

</div>

> [@hosneyalaa](#):
>
> Is it possible to share

@hosneyalaa below is the function:

```auto
import clr

# Add Assemblies for AutoCAD and Civil 3D APIs
clr.AddReference('acmgd')
clr.AddReference('acdbmgd')
clr.AddReference('accoremgd')
clr.AddReference('AecBaseMgd')
clr.AddReference('AecPropDataMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('AeccPressurePipesMgd')
clr.AddReference('acdbmgdbrep')
clr.AddReference('System.Windows.Forms')
clr.AddReference('Civil3DNodes')

# Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class
import Autodesk.AutoCAD.ApplicationServices.Application as acapp

# Import references from AutoCAD
from Autodesk.AutoCAD.Runtime import *
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.EditorInput import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *

# Import references for Civil 3D
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *

adoc = acapp.DocumentManager.MdiActiveDocument
ed = adoc.Editor
civdoc = CivilApplication.ActiveDocument

XX= IN[1]
YY= IN[2]

objects = IN[0]

def move_labels(ids,xx,yy):
	if not hasattr(xx, " __iter__"):
		xx = [xx]
	if not hasattr(yy, " __iter__"):
		yy = [yy]
	if not hasattr(ids, " __iter__"):
		ids = [ids]
	error_report = None
	res = []
	try:
		with adoc.LockDocument():		
		    with adoc.Database as db:		
		        with db.TransactionManager.StartTransaction() as t:		    
		            bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
		            btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
		            for i in ids:
						obj = t.GetObject(i, OpenMode.ForWrite)						
						BX= obj.LabelLocation.X+xx[0]
						BY= obj.LabelLocation.Y+yy[0]
						BZ = obj.LabelLocation.Z						
						obj.UpgradeOpen()
						obj.LabelLocation = Point3d(BX,BY,BZ)
						res.append('Success')
		            t.Commit()
	except:
		import traceback
		error_report = traceback.format_exc()
	if error_report is None:
		return res
	else:
		return error_report

OUT = move_labels(objects,XX,YY)

```

---

<div class="post-metadata">

### Author: ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)
#### Post date: [July 6, 2021, 7:28pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/8 "2021-07-06T19:28:04Z")

</div>

@Kulkul Thanks  
for help  
I can’t dynamo  
I will try to be the change on DraggedOffset properties  
instead of label location  
Will be better  
Thank you

---

<div class="post-metadata">

### Author: ![manrajan.kalimuthu](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@manrajan.kalimuthu](https://forum.dynamobim.com/u/manrajan.kalimuthu)
#### Post date: [July 15, 2021, 1:46pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/9 "2021-07-15T13:46:23Z")

</div>

> [@Kulkul](#):
>
> ```auto
> import clr
> 
> # Add Assemblies for AutoCAD and Civil 3D APIs
> clr.AddReference('acmgd')
> clr.AddReference('acdbmgd')
> clr.AddReference('accoremgd')
> clr.AddReference('AecBaseMgd')
> clr.AddReference('AecPropDataMgd')
> clr.AddReference('AeccDbMgd')
> clr.AddReference('AeccPressurePipesMgd')
> clr.AddReference('acdbmgdbrep')
> clr.AddReference('System.Windows.Forms')
> clr.AddReference('Civil3DNodes')
> 
> # Create an alias to the Autodesk.AutoCAD.ApplicationServices.Application class
> import Autodesk.AutoCAD.ApplicationServices.Application as acapp
> 
> # Import references from AutoCAD
> from Autodesk.AutoCAD.Runtime import *
> from Autodesk.AutoCAD.ApplicationServices import *
> from Autodesk.AutoCAD.EditorInput import *
> from Autodesk.AutoCAD.DatabaseServices import *
> from Autodesk.AutoCAD.Geometry import *
> 
> # Import references for Civil 3D
> from Autodesk.Civil.ApplicationServices import *
> from Autodesk.Civil.DatabaseServices import *
> 
> adoc = acapp.DocumentManager.MdiActiveDocument
> ed = adoc.Editor
> civdoc = CivilApplication.ActiveDocument
> 
> XX= IN[1]
> YY= IN[2]
> 
> objects = IN[0]
> 
> def move_labels(ids,xx,yy):
> if not hasattr(xx, " __iter__"):
> xx = [xx]
> if not hasattr(yy, " __iter__"):
> yy = [yy]
> if not hasattr(ids, " __iter__"):
> ids = [ids]
> error_report = None
> res = []
> try:
> with adoc.LockDocument():		
> with adoc.Database as db:		
> with db.TransactionManager.StartTransaction() as t:		    
> bt = t.GetObject(db.BlockTableId, OpenMode.ForWrite)
> btr = t.GetObject(bt[BlockTableRecord.ModelSpace], OpenMode.ForWrite)
> for i in ids:
> obj = t.GetObject(i, OpenMode.ForWrite)						
> BX= obj.LabelLocation.X+xx[0]
> BY= obj.LabelLocation.Y+yy[0]
> BZ = obj.LabelLocation.Z						
> obj.UpgradeOpen()
> obj.LabelLocation = Point3d(BX,BY,BZ)
> res.append('Success')
> t.Commit()
> except:
> import traceback
> error_report = traceback.format_exc()
> if error_report is None:
> return res
> else:
> return error_report
> 
> OUT = move_labels(objects,XX,YY)
> 
> ```

Hello @Kulkul Kulkul,  
Thanks for the script

1. I want to update multiple labels.
2. Is that possible to make a fixed value of xx and yy?. The current script keeps adding the xx and yy values with previews coordinate location

---

<div class="post-metadata">

### Author: ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)
#### Post date: [October 6, 2021, 4:43pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/10 "2021-10-06T16:43:42Z")

</div>

@hosneyalaa @Kulkul @Tiago.Caldeira @manrajan.kalimuthu check out Camber, my new package for Civil 3D. There are nodes available for setting label properties, including dragged offset.

> [@Camber - A New Package for Civil 3D](https://forum.dynamobim.com/t/camber-a-new-package-for-civil-3d/68941):
>
> Hello fellow Dynamo for Civil 3D users! I’ve just uploaded a new package called Camber to the package manager, and it has hundreds of new nodes for AutoCAD and Civil 3D. Here’s an overview of some of the features: Block attribute definitions MLeaders Catchments Styles Labels Sample Lines Profile Views Section Views Pipe Networks Pressure Pipe Networks Parts Lists Design Checks And lots more to come! There is some overlap with the Civil 3D Toolkit, but I tried to keep it to a minimum to avoid…

 ![Label](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/3/e/3e51680b827153fe53786acae1c000e191f6db97.jpeg)

---

<div class="post-metadata">

### Author: ![manrajan.kalimuthu](https://avatars.discourse-cdn.com/v4/letter/m/7c8e57/32.png) [@manrajan.kalimuthu](https://forum.dynamobim.com/u/manrajan.kalimuthu)
#### Post date: [October 27, 2021, 7:17am UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/11 "2021-10-27T07:17:17Z")

</div>

Hello @mzjensen ,  
I hope you’re doing well.  
I had tried with camber for structure label dragging. I couldn’t able to find the right node to form the graph.  
[Drag label.dwg](https://forum.dynamobim.com/uploads/short-url/69LSR9yTrrYDi2WZUo7rZFdf0SV.dwg) (941.4 KB)  
[DragStructureLabel v0.03.dyn](https://forum.dynamobim.com/uploads/short-url/yzYIxysEmvOC1vpMlWlPQGQ4BWW.dyn) (39.3 KB)

---

<div class="post-metadata">

### Author: ![mzjensen](https://avatars.discourse-cdn.com/v4/letter/m/b77776/32.png) [@mzjensen](https://forum.dynamobim.com/u/mzjensen)
#### Post date: [October 27, 2021, 2:49pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/12 "2021-10-27T14:49:25Z")

</div>

@manrajan.kalimuthu it looks like you are using another package in addition to Camber for working with Structure labels.

 ![Capture](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/2/9/298261ca36eac95b65cc6816fed8a0607a122526.jpeg)

This will not work because the object types used in that package can’t be combined with the object types in Camber. I haven’t implemented functionality for Pipe and Structure labels in Camber yet, but it is on the roadmap.

---

<div class="post-metadata">

### Author: ![mabdelwahedHMVM8](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/mabdelwahedhmvm8/32/163968_2.png) [@mabdelwahedHMVM8](https://forum.dynamobim.com/u/mabdelwahedHMVM8)
#### Post date: [October 1, 2022, 1:55pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/13 "2022-10-01T13:55:48Z")

</div>

@hosneyalaa  
Is this possible to move all labels one time instead of one by one ?

---

<div class="post-metadata">

### Author: ![hosneyalaa](https://sea2.discourse-cdn.com/flex022/user_avatar/forum.dynamobim.com/hosneyalaa/32/100865_2.png) [@hosneyalaa](https://forum.dynamobim.com/u/hosneyalaa)
#### Post date: [October 1, 2022, 6:33pm UTC](https://forum.dynamobim.com/t/draggedoffset-property-label/65826/14 "2022-10-01T18:33:13Z")

</div>

Can you attach any example drawing and example dyn file for your ideas

And  
check out Camber package There are nodes available for setting label properties, including dragged offset.
