Hello everyone, I’m trying to copy a section view created by a callout from model A to model B. I’m using the CreateCallout method to recreate it, but the issue I’m facing is that the position and the extents of the callout are not the same as the one in the source view (as you can see in the image). I think it’s because the two parameters point1 and point2 passed into the CreateCallout method are not correct. Currently, I’m using the min and max of the crop box from the section view created by the callout in model A to recreate it in model B, but maybe this approach is wrong. Do you have any suggestions or ideas?
Currently, I’m using the
minandmaxof the crop box from the section view created by the callout in model A to recreate it in model B, but maybe this approach is wrong.
nah, ur approach is aite. at a glance, this could be a transform issue. as a matter of fact, that func takes pt1 & pt2 as in rvt model space. to get them u transform min & max from box’s local space to rvt model space by b_max = bbox.Transform.OfPoint(bbox.Max), same goes to b_min.
if this has already been taken care of, then still, likely a transform issue. that could be the linkInstance’s transform not being applied.
1 Like
Hi,
In addition to applying the RevitLink transform, the transformation of the host Section View must also be taken into account.
here is an example
import clr
import sys
import System
#
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *
import Autodesk.DesignScript.Geometry as DS
#import Revit API
clr.AddReference('RevitAPI')
import Autodesk
from Autodesk.Revit.DB import *
import Autodesk.Revit.DB as DB
#import transactionManager and DocumentManager (RevitServices is specific to Dynamo)
clr.AddReference('RevitServices')
import RevitServices
from RevitServices.Persistence import DocumentManager
from RevitServices.Transactions import TransactionManager
doc = DocumentManager.Instance.CurrentDBDocument
clr.AddReference("System.Core")
clr.ImportExtensions(System.Linq)
#Preparing input from dynamo to revit
host_section_view = UnwrapElement(IN[0])
name_callount_view_to_copy = IN[1]
link_instance = UnwrapElement(IN[2])
link_doc = link_instance.GetLinkDocument()
#Do some action in a Transaction
TransactionManager.Instance.EnsureInTransaction(doc)
callount_view_to_copy = FilteredElementCollector(link_doc).OfClass(View)\
.FirstOrDefault(System.Func[DB.Element, System.Boolean](lambda v : not v.IsTemplate\
and v.ViewType == ViewType.Section\
and v.Name == name_callount_view_to_copy))
if callount_view_to_copy:
bbx = callount_view_to_copy.get_BoundingBox(None)
tf = host_section_view.CropBox.Transform
new_callout = DB.ViewSection.CreateCallout(doc, host_section_view.Id, host_section_view.GetTypeId(), tf.OfPoint(bbx.Min), tf.OfPoint(bbx.Max))
OUT = new_callout
TransactionManager.Instance.TransactionTaskDone()
1 Like
