Dimension position for column

I make a script that auto dimension the column but i need to place the column dimension in the left side of column and above the column side. how can i specify the dimension placement ?

You can get Vector.X and Vector.Y . Just use it.

# Load the Python Standard and DesignScript Libraries
import sys
import clr
clr.AddReference('ProtoGeometry')
from Autodesk.DesignScript.Geometry import *

# The inputs to this node will be stored as a list in the IN variables.
dataEnteringNode = IN

# Place your code below this line
cols=IN[0]
new=[] #faces for dimensions
for surfs in cols:
	temp=[]
	for surf in surfs:
		v=surf.NormalAtParameter(0,0)
		if abs(v.Z)<0.1:
			temp.append(surf)
	new.append([temp[0],temp[2]])
	new.append([temp[1],temp[3]])

offset=IN[1]
lines=[] #lines for dimension alignment
for surfs in new:
	surf=surfs[0]
	surf1=surfs[1]
	mp=surf.PointAtParameter(0.5,0.5)
	mp1=surf1.PointAtParameter(0.5,0.5)
	line=Line.ByStartPointEndPoint(mp,mp1)
	norm=surf.NormalAtParameter(0,0)
	
	vec=norm.Rotate(Vector.ZAxis(),90)
	if vec.X > 0:
		vec=vec.Reverse()
	if vec.Y <0:
		vec=vec.Reverse()
	
	line=line.Translate(vec,offset)
	
	lines.append(line)
# Assign your output to the OUT variable.
OUT = new,lines

3 Likes

Hey @Hyunu_Kim , was looking for exactly this!
I haven’t gotten into Python yet myself…
But I was wondering what would be needed to read out the lengths of the sides and set a different offset depending on these values. As far as I can understand the script, it uses the center point of the object. With square objects this is fine, but with rectangular shapes it looks a bit off.

Hope you could help me with this.

Think about the vector of the offset direction for a dimension.
the vector musn’t have minus Y value and plus X value.
Unless reverse the offset direction.
And if you are talking about the offset distance, just use distance from center point to each surface to measure. So the dimesion line must be at [desired offset from parellar surface + distance from centerpoint to the parellar surface of demension]

I cannot find [Dimension.ByFaces].
Where can I find it?

try rotating the column by pressing space bar?

スクリーンショット 2023-01-30 085904

Sorry,I can’t find “DimensionByFaces node”… :dizzy_face: