<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: How to scale a CurveLoop? in Revit API Forum</title>
    <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452441#M24909</link>
    <description>&lt;P&gt;I'm unclear are you using Transform.Origin of&amp;nbsp;41.49, 12.34, 23.12 or 0,0,0?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you using ScaleBasis or ScaleBasisAndOrigin?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should be scaling based on the centre point not 0,0,0. By comparing the X and Z values with direction of out of position it seems to be dragging it towards the model origin which indicates that is what you are scaling about.&lt;/P&gt;</description>
    <pubDate>Thu, 08 Jul 2021 11:42:20 GMT</pubDate>
    <dc:creator>RPTHOMAS108</dc:creator>
    <dc:date>2021-07-08T11:42:20Z</dc:date>
    <item>
      <title>How to scale a CurveLoop?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10450180#M24904</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;P&gt;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.&lt;/P&gt;&lt;LI-CODE lang="python"&gt;    #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)&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;However, the created rectangle is in fact smaller, but not centered with the cropbox region. What am I missing?&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 15:39:45 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10450180#M24904</guid>
      <dc:creator>rbarreiros.eng</dc:creator>
      <dc:date>2021-07-07T15:39:45Z</dc:date>
    </item>
    <item>
      <title>Re: How to scale a CurveLoop?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10450901#M24905</link>
      <description>&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7228557"&gt;@rbarreiros.eng&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Hi,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Try the&amp;nbsp;&lt;STRONG&gt;ScaleBasisAndOrigin&amp;nbsp;&lt;/STRONG&gt;method.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;A href="https://www.revitapidocs.com/2021.1/460caa53-d288-7cfe-dbb8-eadf4682329d.htm" target="_blank"&gt;https://www.revitapidocs.com/2021.1/460caa53-d288-7cfe-dbb8-eadf4682329d.htm&lt;/A&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Wed, 07 Jul 2021 20:35:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10450901#M24905</guid>
      <dc:creator>Organon</dc:creator>
      <dc:date>2021-07-07T20:35:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to scale a CurveLoop?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452033#M24906</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2881136"&gt;@Organon&lt;/a&gt;&amp;nbsp;,&lt;/P&gt;&lt;P&gt;Thanks for the suggestion. However, I had tried that and it's still not working. I figured that since I want the center of the transform to always be the same, regardless of the scale factor used, I should be using ScaleBasis instead of ScaleBasisAndOrigin which, as I understand, would also scale the origin accordingly.&lt;/P&gt;&lt;P&gt;Would I have to apply the transform to each curve within the CurveLoop, instead of the CurveLoop itself?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 08:26:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452033#M24906</guid>
      <dc:creator>rbarreiros.eng</dc:creator>
      <dc:date>2021-07-08T08:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to scale a CurveLoop?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452296#M24907</link>
      <description>&lt;P&gt;If the thing is scaling correctly but off centre it likely indicates origin is wrong in transform being used.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;"Transform.ScaleBasisAndOrigin&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;The resulting transformation is equivalent to the application of this transformation and then the uniform scale, in this order.&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;Transform.ScaleBasis&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;The resulting transformation is equivalent to the application of the uniform scale and then this transformation, in this order."&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Have you plotted the transform origin to see it is where you expect?&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 10:57:53 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452296#M24907</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-07-08T10:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: How to scale a CurveLoop?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452396#M24908</link>
      <description>&lt;P&gt;Yes, that would make sense...However, I'm specifying the correct center point as you can see in the image. I'm reporting internal coordinates in Revit and I can confirm that is the result of the cropRegionCenter variable&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rbarreiroseng_0-1625742923439.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/938943i733A621E921D4635/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rbarreiroseng_0-1625742923439.png" alt="rbarreiroseng_0-1625742923439.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="rbarreiroseng_1-1625743051098.png" style="width: 400px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/938946i9A124F0DE70B1FA0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="rbarreiroseng_1-1625743051098.png" alt="rbarreiroseng_1-1625743051098.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;However, the rectangle I get is off...&lt;/P&gt;&lt;P&gt;Please note that the rectangle I get when I use cropRegionCenter as the Origin of the Transform is even farther than the blue rectangle in the image. The image actually reports the rectangle with a Transform.Origin = XYZ(0,0,0).&lt;/P&gt;&lt;P&gt;Could it be that the Transform origin I have to use is somehow in relative coordinates instead of model coordinates?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 11:20:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452396#M24908</guid>
      <dc:creator>rbarreiros.eng</dc:creator>
      <dc:date>2021-07-08T11:20:30Z</dc:date>
    </item>
    <item>
      <title>Re: How to scale a CurveLoop?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452441#M24909</link>
      <description>&lt;P&gt;I'm unclear are you using Transform.Origin of&amp;nbsp;41.49, 12.34, 23.12 or 0,0,0?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Are you using ScaleBasis or ScaleBasisAndOrigin?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You should be scaling based on the centre point not 0,0,0. By comparing the X and Z values with direction of out of position it seems to be dragging it towards the model origin which indicates that is what you are scaling about.&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 11:42:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452441#M24909</guid>
      <dc:creator>RPTHOMAS108</dc:creator>
      <dc:date>2021-07-08T11:42:20Z</dc:date>
    </item>
    <item>
      <title>Re: How to scale a CurveLoop?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452682#M24910</link>
      <description>&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7228557"&gt;@rbarreiros.eng&lt;/a&gt;,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;You can apply multiple transformations to the curve loop:&amp;nbsp; move it to (0,0,0), scale it and move it back.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;Transform t1 = Transform.CreateTranslation(XYZ.Zero.Subtract(cropRegionCenter));
Transform t2 = Transform.Identity.ScaleBasis(0.9);
            
cropboxCurveLoop.Transform(t1);
cropboxCurveLoop.Transform(t2);
cropboxCurveLoop.Transform(t1.Inverse);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Regards,&lt;/FONT&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 13:01:13 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10452682#M24910</guid>
      <dc:creator>Organon</dc:creator>
      <dc:date>2021-07-08T13:01:13Z</dc:date>
    </item>
    <item>
      <title>Re: How to scale a CurveLoop?</title>
      <link>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10453147#M24911</link>
      <description>&lt;P&gt;Many thanks&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/2881136"&gt;@Organon&lt;/a&gt;&amp;nbsp;! That was it!&lt;/P&gt;</description>
      <pubDate>Thu, 08 Jul 2021 15:29:09 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/revit-api-forum/how-to-scale-a-curveloop/m-p/10453147#M24911</guid>
      <dc:creator>rbarreiros.eng</dc:creator>
      <dc:date>2021-07-08T15:29:09Z</dc:date>
    </item>
  </channel>
</rss>

