Wall Dimensions not visible in view

Wall Dimensions not visible in view

sensiblehira
Advocate Advocate
841 Views
9 Replies
Message 1 of 10

Wall Dimensions not visible in view

sensiblehira
Advocate
Advocate

I am trying to create wall Dimensions for exterior walls , so my python script is running successfully but the dimensions are not visible in the view or any other view but I can select them by select by id. Can anyone help me identify the problem here:

opt = Options()
opt.ComputeReferences = True
opt.IncludeNonVisibleObjects = True
opt.View = doc.ActiveView
for twall in targetWalls:
	refarray = ReferenceArray()
	for obj in twall.get_Geometry(opt):
		if isinstance(obj, Solid):
			gline = obj
			vertReferences,vertFaces = [],[]
			for face in gline.Faces:
				if face.FaceNormal.Normalize().IsAlmostEqualTo(XYZ(0,0,1)) == False:
					vertReferences.append(face.Reference)
					vertFaces.append(face)
	if type == "Option 1":
		opt1r,opt1f = [],[]
		refVector = twall.Orientation
		bbox = twall.get_BoundingBox(doc.ActiveView)
		dim_line = twall.Location.Curve.CreateOffset(offDist,refVector)
		for ref,f in zip(vertReferences,vertFaces):
			if round(refVector.DotProduct(f.FaceNormal)) == 0:
				opt1r.append(ref)
				opt1f.append(f)
		l = 0
		refa = [0,0]
		le = []
		for a,r in zip(opt1f,opt1r):
			p = a.Origin
			for a1,r1 in zip(opt1f,opt1r):
				len = p.DistanceTo(a1.Origin)
				le.append(len)
				if len > l:
					l = len
					refa[0] = r
					refa[1] = r1
		for ref in refa:
			refarray.Append(ref)
		dim = doc.Create.NewDimension(doc.ActiveView,dim_line,refarray)
		dimensions.append(dim)
0 Likes
842 Views
9 Replies
Replies (9)
Message 2 of 10

jeremy_tammik
Alumni
Alumni

Maybe the best place to start exploring this is to ensure manually through the end user interface that the view settings enable visibility of dimensions. Can you see dimensions when you create them manually in the UI?

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 3 of 10

sensiblehira
Advocate
Advocate

Some of them are visible but some of them are not

0 Likes
Message 4 of 10

sensiblehira
Advocate
Advocate

Yes I can see them when I create them manually...I am using Revit 2021 by the way

0 Likes
Message 5 of 10

jeremy_tammik
Alumni
Alumni

Okery-doke... so it may be your API is problematic indeed. Next, I suggest you search this forum for previous discussion of similar issues, e.g., looking for 'dimension visible'. There were several of them, and they will probably help in your case as well. Please let us know how you end up fixing this. Thank you!

  

Jeremy Tammik Developer Advocacy and Support + The Building Coder + Autodesk Developer Network + ADN Open
0 Likes
Message 6 of 10

sensiblehira
Advocate
Advocate

Someone suggested me that the dimensions created with references might not be aligned with the view that is why they are not visible but I am not sure how to implement it in my code

0 Likes
Message 7 of 10

NGM_AiYo
Advocate
Advocate
Maybe they're at (0,0,0). You can print Dimension segments' location to check it.
I have met this situation, cause the references is not perfectly parallel.
0 Likes
Message 8 of 10

sensiblehira
Advocate
Advocate

yes its origin is coming out to be 0 and there is no location to it

Message 9 of 10

sensiblehira
Advocate
Advocate

and the property for are References available is coming out to be false

Message 10 of 10

sensiblehira
Advocate
Advocate

it turns out that the line:

if face.FaceNormal.Normalize().IsAlmostEqualTo(XYZ(0,0,1)) == False:

was not filtering all the horizontal lanes

0 Likes