User3
December 26, 2022, 5:01pm
1
Hi Everyone
I’m trying to set the length of Alignment SubEntities.
I’ve not found any node in Camber Package, Civil3D toolkit or Arkance to do that, so I’m trying to do it with Python.
I tried but it doesn’t work, can you help me? I attach the drawing and the dyn file.
Thank you
Drawing5.dwg (2.1 MB)
Dyn.dyn (15.6 KB)
User3
December 27, 2022, 7:20am
3
Exactly I used this function in my script but It doesn’t work, can you take a look? I attached the files
hi
import sys
import clr
clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry')
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
from System.Collections.Generic import Dictionary
adoc = Application.DocumentManager.MdiActiveDocument
cdoc = CivilApplication.ActiveDocument
from Autodesk.DesignScript.Geometry import *
def SubEntities(alw , lengths):
global adoc
global cdoc
output = []
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
#for Ent in Entities:
EntId = alw.InternalObjectId
obj = t.GetObject(EntId, OpenMode.ForWrite)
objEntities0 = obj.Entities[0]
output.append(objEntities0)
t.Commit()
return output
OUT = SubEntities(IN[0] , IN[1])
1 Like
User3
December 27, 2022, 9:13am
5
hosneyalaa:
import sys
import clr
clr.AddReference('AcMgd')
clr.AddReference('AcDbMgd')
clr.AddReference('AeccDbMgd')
clr.AddReference('ProtoGeometry')
from Autodesk.AutoCAD.ApplicationServices import *
from Autodesk.AutoCAD.DatabaseServices import *
from Autodesk.AutoCAD.Geometry import *
from Autodesk.Civil.ApplicationServices import *
from Autodesk.Civil.DatabaseServices import *
from System.Collections.Generic import Dictionary
adoc = Application.DocumentManager.MdiActiveDocument
cdoc = CivilApplication.ActiveDocument
from Autodesk.DesignScript.Geometry import *
def SubEntities(alw , lengths):
global adoc
global cdoc
output = []
with adoc.LockDocument():
with adoc.Database as db:
with db.TransactionManager.StartTransaction() as t:
#for Ent in Entities:
EntId = alw.InternalObjectId
obj = t.GetObject(EntId, OpenMode.ForWrite)
objEntities0 = obj.Entities[0]
output.append(objEntities0)
t.Commit()
return output
OUT = SubEntities(IN[0] , IN[1])
Hi
I tried your script, but the SubEntities remain with a different length than the one I set, why?
I attach an image
Thank you
User3
December 27, 2022, 1:50pm
7
Hi
In this way it seems that the code reads only the first value of the Subentities.
Instead I would like to modify the lenghts (22, 27.64 and so on) in all Subentities with 20 m of length.
My language is not good
SubEntities Possible one or more objects
In your drawing it is one element
SubEntitie[0].length =20
User3
December 27, 2022, 2:36pm
9
I don’t understand,
I want that 22.02, 27.64, 10, 15, 19.999 —> 20, 20, 20, 20, 20
Can you help me?
No problem, tomorrow
I will try it
I am try it but not Succeed
1 Like
User3
December 28, 2022, 8:59am
12
Hi, maybe the cause is this?