<?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 get the coordinates of a line in gdl? in GDL</title>
    <link>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358043#M1307</link>
    <description>&lt;P&gt;The ratio is just a value you chose of how far along the line x4 and x1 are.&lt;/P&gt;&lt;P&gt;if you use .5&amp;nbsp; it will be&amp;nbsp; in the middle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy the full code I posted in a new object 2D script and change to value of ration and offset to see how the 2D view changes.&lt;/P&gt;</description>
    <pubDate>Wed, 05 Oct 2022 13:57:48 GMT</pubDate>
    <dc:creator>julienK</dc:creator>
    <dc:date>2022-10-05T13:57:48Z</dc:date>
    <item>
      <title>How to get the coordinates of a line in gdl?</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/357939#M1302</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LeeJaeYoung_0-1664891893466.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/30410i8B4A0E67C9E4F0A0/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LeeJaeYoung_0-1664891893466.png" alt="LeeJaeYoung_0-1664891893466.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In gdl, we know the coordinates of p1 and p2 and we know the distance from x1 to x4. Then how do we get the coordinates of x1~x4?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;2D&lt;BR /&gt;We know the coordinates of p1 and p2. And we know the distance from p1 to x4.&lt;BR /&gt;1. How do you find the angle with p1 and p2?&lt;BR /&gt;2. How do you find the coordinates of x4? (Example: Autolisp (setq x4 (polart p1 angle distance))&lt;BR /&gt;3. How do you find the coordinates of x3?&lt;/P&gt;&lt;P&gt;Do I need to convert to radians when using angles?&lt;/P&gt;&lt;P&gt;Thanks for reading.&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 14:42:00 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/357939#M1302</guid>
      <dc:creator>LeeJaeYoung</dc:creator>
      <dc:date>2022-10-04T14:42:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the coordinates of a line in gdl?</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/357946#M1303</link>
      <description>&lt;P&gt;1. calculate the angle of the line to y or x axis&lt;/P&gt;&lt;P&gt;2. rot2 command -&amp;nbsp; rotate the coordinate system so the line between p1 and p2 is vertical or horizontal&lt;/P&gt;&lt;P&gt;3. the rest should be easy... you have only straight lines to draw between points&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 15:35:25 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/357946#M1303</guid>
      <dc:creator>Miha Nahtigal</dc:creator>
      <dc:date>2022-10-04T15:35:25Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the coordinates of a line in gdl?</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/357951#M1304</link>
      <description>&lt;P&gt;It means using ADD2 and ROT2 to handle it.&lt;BR /&gt;thank you ^^&lt;/P&gt;</description>
      <pubDate>Tue, 04 Oct 2022 16:09:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/357951#M1304</guid>
      <dc:creator>LeeJaeYoung</dc:creator>
      <dc:date>2022-10-04T16:09:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the coordinates of a line in gdl?</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358033#M1305</link>
      <description>&lt;P&gt;the easiest way to find the coordinates of a point on a line is to use the parametric equation of a line:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;x4 = x1+((x2-x1)*(ratio))&lt;BR /&gt;y4 = y1+((y2-y1)*(ratio))&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;with p1(x1,y1) p2(x2,y2).&lt;/P&gt;&lt;P&gt;ratio is a number between 0 and 1 representing the distance from p1 to p2&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;just a bit of math to find the rest:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="cpp"&gt;!p1 &amp;amp; p2

xp1 = -5
yp1 = 0
xp2 = 0
yp2 = 5

!distance from p1 to x4  p1 to x1
ratio = .25



x4 = xp1+((xp2-xp1)*(ratio))
y4 = yp1+((yp2-yp1)*(ratio))

x1 = xp1+((xp2-xp1)*(1-ratio))
y1 = yp1+((yp2-yp1)*(1-ratio))


!slope of the line need to find x3 and x2
THETA = atn((yp2-yp1)/(xp2-xp1))

! distance  between x3 and x4
offset = 2

! coordinates of point x3
x3 = x4+ offset *cos(90+THETA)
y3 = y4+  offset *sin(90+THETA)

x2 = x1+ offset *cos(90+THETA)
y2 = y1+  offset *sin(90+THETA)




!draw lines

line2 xp1,yp1,xp2,yp2

line2 x4,y4,x3,y3
line2 x1,y1,x2,y2

line2 x3,y3,x2,y2&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 05 Oct 2022 12:42:51 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358033#M1305</guid>
      <dc:creator>julienK</dc:creator>
      <dc:date>2022-10-05T12:42:51Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the coordinates of a line in gdl?</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358041#M1306</link>
      <description>&lt;P&gt;Could you please explain the formula to find the ratio in an easy way?&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 13:16:35 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358041#M1306</guid>
      <dc:creator>LeeJaeYoung</dc:creator>
      <dc:date>2022-10-05T13:16:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the coordinates of a line in gdl?</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358043#M1307</link>
      <description>&lt;P&gt;The ratio is just a value you chose of how far along the line x4 and x1 are.&lt;/P&gt;&lt;P&gt;if you use .5&amp;nbsp; it will be&amp;nbsp; in the middle.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Copy the full code I posted in a new object 2D script and change to value of ration and offset to see how the 2D view changes.&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 13:57:48 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358043#M1307</guid>
      <dc:creator>julienK</dc:creator>
      <dc:date>2022-10-05T13:57:48Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the coordinates of a line in gdl?</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358049#M1308</link>
      <description>&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="LeeJaeYoung_0-1664979643118.png" style="width: 400px;"&gt;&lt;img src="https://community.graphisoft.com/t5/image/serverpage/image-id/30428i8B613E8D7C6A6A03/image-size/medium?v=v2&amp;amp;px=400" role="button" title="LeeJaeYoung_0-1664979643118.png" alt="LeeJaeYoung_0-1664979643118.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;LI-CODE lang="markup"&gt;!p1 &amp;amp; p2

xp1 = HA
yp1 = B-D2-0.05
xp2 = 0
yp2 = B

!distance from p1 to x4 p1 to x1
ratio = .1
ratio1 = .11

x4 = xp1+((xp2-xp1)*(ratio1))
y4 = yp1+((yp2-yp1)*(ratio1))

x1 = xp1+((xp2-xp1)*(1-ratio))
y1 = yp1+((yp2-yp1)*(1-ratio))


!slope of the line need to find x3 and x2
THETA = atn((yp2-yp1)/(xp2-xp1)) + 180

! distance between x3 and x4
offset = 0.05

! coordinates of point x3
x3 = x4+ offset *cos(90+THETA)
y3 = y4+ offset *sin(90+THETA)

x2 = x1+ offset *cos(90+THETA)
y2 = y1+ offset *sin(90+THETA)

!draw lines
line2 xp1,yp1,xp2,yp2

line2 x4,y4,x3,y3
line2 x1,y1,x2,y2

line2 x3,y3,x2,y2&lt;/LI-CODE&gt;</description>
      <pubDate>Wed, 05 Oct 2022 23:30:40 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358049#M1308</guid>
      <dc:creator>LeeJaeYoung</dc:creator>
      <dc:date>2022-10-05T23:30:40Z</dc:date>
    </item>
    <item>
      <title>Re: How to get the coordinates of a line in gdl?</title>
      <link>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358053#M1309</link>
      <description>&lt;P&gt;thank you so much&lt;/P&gt;</description>
      <pubDate>Wed, 05 Oct 2022 14:42:34 GMT</pubDate>
      <guid>https://community.graphisoft.com/t5/GDL/How-to-get-the-coordinates-of-a-line-in-gdl/m-p/358053#M1309</guid>
      <dc:creator>LeeJaeYoung</dc:creator>
      <dc:date>2022-10-05T14:42:34Z</dc:date>
    </item>
  </channel>
</rss>

