Cannot create linear dimensions on filled region

Hi everybody,

I start to create a dynamo scrip for my project, I have easily make to the section of the filled region, but I m a little bit stuck at the point how to create the dimensions of the filled region. I would like dimensions to be lock on the lines of the filled region not new ones. So what you think I should implement here!!!

Also i would like to add the layoutdesign