Plan Region

Plan Region

ryansC5XHQ
Contributor Contributor
2,727 Views
10 Replies
Message 1 of 11

Plan Region

ryansC5XHQ
Contributor
Contributor

I have looked through the SDK and can't find a method for creating a Plan Region. Am I overlooking a class?

0 Likes
2,728 Views
10 Replies
Replies (10)
Message 2 of 11

jeremytammik
Autodesk
Autodesk

What class does it appear as when you examine it in RevitLookup?

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 3 of 11

ryansC5XHQ
Contributor
Contributor

Plan Region Selection.JPG

0 Likes
Message 4 of 11

ryansC5XHQ
Contributor
Contributor

I think I need to be looking at "PlanViewRange" Class.  I think this is it and I overlooked it, but still doesn't allude to a create method?!

0 Likes
Message 5 of 11

jeremytammik
Autodesk
Autodesk

Dear Ryan,

 

Thank you for your update.

 

Nope, I do not think that is the right class at all.

 

Look at its description:

 

https://apidocs.co/apps/revit/2019/7edc5f13-a5fa-5c7a-9a03-ac6cbed1f005.htm

 

The PlanViewRange represents the view range of a plan view or a plan region. It records the element ids of the levels which a plane is relative to and the offset of each plane from that level.

 

If you scroll down to the bottom in the RevitLookup snoop window that you sent an image of, I think the class name is listed at the bottom.

 

The base class is show as Element, followed by its properties and methods.

 

Further down, in the part not shown, you see the derived classes in their inheritance hierarchy, ending with the class of the object you picked.

 

I hope this helps.

 

Best regards,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 6 of 11

ryansC5XHQ
Contributor
Contributor

Jeremy,

 

Thank you so much for the replies.  I looked at the evidence presented by the "Revit Lookup" tool (I hope I am wrong with my hypothesis), and it seems that there is no support with "Plan Regions".  I think one would say this is desperately needed in the architectural industry.  Your comments ( See Picture below ).....

 

 

Blessings,

Ryan

Bottom List.JPG

 

0 Likes
Message 7 of 11

SONA-ARCHITECTURE
Advocate
Advocate

Hi,

I would like to know if it is possible to create Plan Region?

I can duplicate a Plan Region created before but, I can't create a new Plan Region in Current view

I can't find this possibility in the ApiDocs

Thx

Pierre NAVARRA
SONA-Architecture.
http://www.sona-architecture.com
https://fr.linkedin.com/in/pierre-navarra-62032a107
0 Likes
Message 8 of 11

jeremytammik
Autodesk
Autodesk

Dear Pierre and others,

 

Please search the Revit Idea Station for a corresponding wish list entry and vote for that.

 

If none exists, please create one and add your comments there:

 

https://forums.autodesk.com/t5/revit-ideas/idb-p/302

 

Tag it as an API wish:

 

https://forums.autodesk.com/t5/revit-ideas/idb-p/302/tab/most-recent/label-name/api

 

Ensure it gets as many votes as possible to underline its importance to you and the rest of the developer community.

 

The Revit Idea Station is currently one of the main driving input forces for Revit API enhancements.

 

The Revit development team look there. Your comment here in the discussion forum might be overlooked.

 

Thank you!

 

This topic was also previously raised discussed in this older thread with DAS SFDC ticket number 10451315:

 

https://forums.autodesk.com/t5/revit-api-forum/plan-region-through-api/td-p/5501655

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 9 of 11

SONA-ARCHITECTURE
Advocate
Advocate

Jeremy

 

Hope you are well.

Thx for your suggestion.

 

What do you think about this :

CmndID = RevitCommandId.LookupCommandId('ID_NEW_PLAN_REGION')
CmId = CmndID.Id
uiapp.PostCommand(CmndID)

And, creating curves in my Python Script?

Pierre NAVARRA
SONA-Architecture.
http://www.sona-architecture.com
https://fr.linkedin.com/in/pierre-navarra-62032a107
0 Likes
Message 10 of 11

jeremytammik
Autodesk
Autodesk

Dear Pierre,

 

That sounds like a brilliant idea and a promising starting point for a workaround.

 

I am very interested in hearing how you get on with that idea and look forward to hearing about your successful results.

 

Thank you very much, and best of luck to you implementing this!

 

Cheers,

 

Jeremy

 



Jeremy Tammik
Developer Technical Services
Autodesk Developer Network, ADN Open
The Building Coder

0 Likes
Message 11 of 11

SONA-ARCHITECTURE
Advocate
Advocate

Hi Jeremy

 

Thanks for your encouragements.

Ok, I've tried to developp my research with Python code first.

Here is a bit of my code :
My problem is : the PostCommand runs the Create PlanRegion, model curves are created in my model but not in the boundary tool, here is the result ....

 

screenshot_412.png

#démarre une transaction
TransactionManager.Instance.EnsureInTransaction(doc)

command = PostableCommand.PlanRegion
createPlanRegion = RevitCommandId.LookupPostableCommandId(command)
command = uiapp.PostCommand(createPlanRegion)

#Create sketch plane
origin = XYZ.Zero
normal = XYZ.BasisZ

plane = Autodesk.Revit.DB.Plane.CreateByNormalAndOrigin(normal, origin)
skplane = SketchPlane.Create(doc, plane)

for line in lst_lines:
	#Get start and end point of line
	startPoint = line.StartPoint	
	endPoint = line.EndPoint
	#Get XYZ start and end point
	XYZStart = XYZ(startPoint.X,startPoint.Y,startPoint.Z)
	XYZEnd = XYZ(endPoint.X,endPoint.Y,endPoint.Z)
	#create NewLine()	
	newLine = Autodesk.Revit.DB.Line.CreateBound(XYZStart, XYZEnd)	
	#create NewModelCurve()
	crv = doc.Create.NewModelCurve(newLine, skplane)
	lst_modelCurves.Add(crv)
	
#termine une transaction
TransactionManager.Instance.TransactionTaskDone()
#####################################

 

 What's wrong in my code?? ModelCurves?

Pierre NAVARRA
SONA-Architecture.
http://www.sona-architecture.com
https://fr.linkedin.com/in/pierre-navarra-62032a107
0 Likes