# ProfileView Datum

**URL:** <https://forum.dynamobim.com/t/profileview-datum/67213>\
**Category:** Civil 3D\
**Tags:** python\
**Created:** [August 16, 2021, 3:11pm UTC](https://forum.dynamobim.com/t/profileview-datum/67213 "2021-08-16T15:11:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![gduffy6SEQG](https://avatars.discourse-cdn.com/v4/letter/g/cdc98d/32.png) [@gduffy6SEQG](https://forum.dynamobim.com/u/gduffy6SEQG)\
**Post date:** [August 16, 2021, 3:11pm UTC](https://forum.dynamobim.com/t/profileview-datum/67213/1 "2021-08-16T15:11:30Z")

</div>

I wish to read & set the Datum of a ProfileView, so its the level range lower and upper. Im familiar with Dynamo and have just recently posted a query which required python, as I believe to solve this requires the same. Im complete novice and came up with this -

```auto
           profileView = IN[0]

            Datum = []
            
            for pv in profileView:
                profile_view = t.GetObject(profile_view_id, OpenMode.ForWrite, True)
                Profile_View_Name = profile_view.Name
                Datum = profile_view.ElevationMin
            # Commit before end transaction
            #t.Commit()
            #pass

# Assign your output to the OUT variable.
OUT = Datum

```

I suppose Im looking for something I can work from to understand the syntax of it all. Not a lot online for civil3D python

Thanks

---

<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:** [August 17, 2021, 10:51am UTC](https://forum.dynamobim.com/t/profileview-datum/67213/2 "2021-08-17T10:51:18Z")

</div>

hi  
try this

```auto
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 get_profileView_info(profileViews):
	
	global adoc
	global cdoc
	
	output = []
	

	if not profileViews:
		return
	
	if not isinstance(profileViews, list):
		profileViews = [profileViews]

	with adoc.LockDocument():
	    with adoc.Database as db:
	        with db.TransactionManager.StartTransaction() as t:
				for profileView in profileViews:			
					profileViewId = profileView.InternalObjectId
					obj = t.GetObject(profileViewId, OpenMode.ForRead)
										
					if isinstance(obj,ProfileView):
					   Profile_View_Name = obj.Name
					   Datum = obj.ElevationMin
					   output.append([Profile_View_Name,Datum])
						
				t.Commit()
	return output 		

OUT = get_profileView_info(IN[0])

```

 ![pppp](https://us1.discourse-cdn.com/flex022/uploads/dynamobim/original/3X/1/0/106aa1abb4d5d14ca9458cf367eb3af77a682533.jpeg)

---

<div class="post-metadata">

**Author:** ![gduffy6SEQG](https://avatars.discourse-cdn.com/v4/letter/g/cdc98d/32.png) [@gduffy6SEQG](https://forum.dynamobim.com/u/gduffy6SEQG)\
**Post date:** [August 17, 2021, 11:33am UTC](https://forum.dynamobim.com/t/profileview-datum/67213/3 "2021-08-17T11:33:03Z")

</div>

That worked ! Thanks very much, another helping hand from yourself. Much appreciated. I will now look at how to set this value based on your code, helps the learning process.

There were a few errors with spacing/indents and it took some messing about with tab key but got there in the end
