Function
def PromptForEntity( prompt, filetype):
global adoc
global ed
options = PromptEntityOptions("%s"%prompt)
options.SetRejectMessage("\nThe selected object is not a %s\n"%str(filetype))
options.AddAllowedClass(clr.GetClrType(filetype), True)
result = doc.Editor.GetEntity(options)
if result.Status != PromptStatus.OK:
ed.WriteMessage("\n The select target is " +str(filetype) +" please select " +str(filetype) + " \n")
if result.Status == PromptStatus.OK:
ed.WriteMessage("\ntarget has been selected\n")
ed.WriteMessage("\ntarget has been selected%s\n\n\n\n"%str(result.ObjectId))
return result.ObjectId
ed.WriteMessage("I will return Null ")
return ObjectId.Null
Example
try:
surfaceId = PromptForEntity("Select the surface to add a boundary to", TinSurface)
plineId = PromptForEntity("Select the object to use as a boundary", Polyline)
coll = ObjectIdCollection()
coll.Add(plineId)
ed.WriteMessage("pLINE COLLECTION HAS BEEN MADE")
oSurface = t.GetObject(surfaceId, OpenMode.ForWrite)
#
oSurface.BoundariesDefinition.AddBoundaries(coll, 100, SurfaceBoundaryType.Outer, True)
oSurface.Rebuild()
ed.WriteMessage("Rebuilt Done")
# Commit before end transaction
t.Commit()
except:
ed.WriteMessage("Failed to add the boundary")
Reference
http://help.autodesk.com/view/CIV3D/2020/ENU/?guid=GUID-7C32E309-9B54-42A0-A4DC-C6FD592071F2