Message 1 of 8
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hi,
I'm trying to scale a CurveLoop. I got this curveloop from the CropRegionShapeManager that gets me the lines that define a view's cropbox.
I now would like to scale those 4 lines to create a smaller rectangle. I would think that I'd have to use the Transform method of the CurveLoop class and pass in a transform with an origin equal to the center point of the curves in the loop and a ScaleBasis applied to it.
#Get the center point of the cropbox's BoundingBox
bBox = view.CropBox
bBoxModel = BoundingBoxXYZ()
bBoxTransf = bBox.Transform
bBoxModel.Min = bBoxTransf.OfPoint(bBox.Min)
bBoxModel.Max = bBoxTransf.OfPoint(bBox.Max)
bBoxcenter = XYZ((bBoxModel.Min.X+bBoxModel.Max.X)/2,(bBoxModel.Min.Y+bBoxModel.Max.Y)/2,(bBoxModel.Min.Z+bBoxModel.Max.Z)/2)
#Project center point onto plane of the view
plane = Plane.CreateByNormalAndOrigin(view.ViewDirection,view.Origin)
v = bBoxcenter - plane.Origin
dist = plane.Normal.DotProduct(v)
cropRegionCenter = bBoxcenter - dist * plane.Normal
#Cropbox Curve Loop
cropboxCurveLoop = view.GetCropRegionShapeManager().GetCropShape()[0]
#Create transform to scale the curve loop
transf = Transform.Identity
transf.Origin = cropRegionCenter
transf = transf.ScaleBasis(0.9)
cropboxCurveLoop.Transform(transf)
However, the created rectangle is in fact smaller, but not centered with the cropbox region. What am I missing?
Solved! Go to Solution.