<?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: create a centerline by two points in Inventor Programming - iLogic, Macros, AddIns &amp; Apprentice</title>
    <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12714955#M166252</link>
    <description>&lt;P&gt;Just another odd thought that comes to mind, but it may be a stretch of the imagination.&amp;nbsp; Since this is a drawing sketch being created within a drawing view, you may have to translate the two transient Point2d objects from 'sheet space' to 'view space' and/or to 'sketch space'.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingSketch_SheetToSketchSpace" target="_blank" rel="noopener"&gt;DrawingSketch.SheetToSketchSpace&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingView_SheetToDrawingViewSpace" target="_blank" rel="noopener"&gt;DrawingView.SheetToDrawingViewSpace&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Wed, 17 Apr 2024 15:08:20 GMT</pubDate>
    <dc:creator>WCrihfield</dc:creator>
    <dc:date>2024-04-17T15:08:20Z</dc:date>
    <item>
      <title>create a centerline by two points</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12710357#M166180</link>
      <description>&lt;P&gt;Trying to add a centerline to a drawing view but it keeps failing at the centerlines.add method.&amp;nbsp; All I get is an ambiguous error message.&amp;nbsp; What am i missing?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;DrawingDocument oDoc = (DrawingDocument)oInventorApp.ActiveDocument;&lt;BR /&gt;Sheet oSheet = oDoc.ActiveSheet;&lt;BR /&gt;DrawingView oView = oSheet.DrawingViews[1];&lt;BR /&gt;Centerlines oLines = oSheet.Centerlines;&lt;/P&gt;&lt;P&gt;DrawingSketch oSketch = oView.Sketches.Add();&lt;BR /&gt;SketchPoints oPoints = oSketch.SketchPoints;&lt;BR /&gt;oSketch.Edit();&lt;BR /&gt;SketchPoint pnt1 = oPoints.Add(oITransGeo.CreatePoint2d(0, 0), false);&lt;BR /&gt;SketchPoint pnt2 = oPoints.Add(oITransGeo.CreatePoint2d(216 * 2.54, 0), false);&lt;BR /&gt;oSketch.ExitEdit();&lt;/P&gt;&lt;P&gt;GeometryIntent oInt1 = oSheet.CreateGeometryIntent(pnt1);&lt;BR /&gt;GeometryIntent oInt2 = oSheet.CreateGeometryIntent(pnt2);&lt;/P&gt;&lt;P&gt;ObjectCollection oCollection = oInventorApp.TransientObjects.CreateObjectCollection();&lt;BR /&gt;oCollection.Add(oInt1);&lt;BR /&gt;oCollection.Add(oInt2);&lt;/P&gt;&lt;P&gt;Centerline line = oLines.Add(oCollection);&lt;/P&gt;</description>
      <pubDate>Mon, 15 Apr 2024 19:50:19 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12710357#M166180</guid>
      <dc:creator>breinkemeyer</dc:creator>
      <dc:date>2024-04-15T19:50:19Z</dc:date>
    </item>
    <item>
      <title>Re: create a centerline by two points</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12710988#M166184</link>
      <description>&lt;P&gt;Hi &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7375074"&gt;@breinkemeyer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It might be the declaration of sketchpoint instead of offering point2d directly into&amp;nbsp; geometry intent.&lt;/P&gt;&lt;P&gt;See intent help page &lt;A href="https://help.autodesk.com/view/INVNTOR/2022/ENU/?guid=GeometryIntent_Intent" target="_blank" rel="noopener"&gt;here&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 16 Apr 2024 04:29:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12710988#M166184</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2024-04-16T04:29:46Z</dc:date>
    </item>
    <item>
      <title>Re: create a centerline by two points</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12714955#M166252</link>
      <description>&lt;P&gt;Just another odd thought that comes to mind, but it may be a stretch of the imagination.&amp;nbsp; Since this is a drawing sketch being created within a drawing view, you may have to translate the two transient Point2d objects from 'sheet space' to 'view space' and/or to 'sketch space'.&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingSketch_SheetToSketchSpace" target="_blank" rel="noopener"&gt;DrawingSketch.SheetToSketchSpace&lt;/A&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://help.autodesk.com/view/INVNTOR/2024/ENU/?guid=DrawingView_SheetToDrawingViewSpace" target="_blank" rel="noopener"&gt;DrawingView.SheetToDrawingViewSpace&lt;/A&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 15:08:20 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12714955#M166252</guid>
      <dc:creator>WCrihfield</dc:creator>
      <dc:date>2024-04-17T15:08:20Z</dc:date>
    </item>
    <item>
      <title>Re: create a centerline by two points</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12715021#M166254</link>
      <description>&lt;P&gt;So this may not be the best way to do it, but I ended up adding two workpoints to the assembly then translated them using modeltosheetspace and adding a sketchline between those points.&amp;nbsp; Then I changed the linetype to chained.&amp;nbsp;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 15:28:47 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12715021#M166254</guid>
      <dc:creator>breinkemeyer</dc:creator>
      <dc:date>2024-04-17T15:28:47Z</dc:date>
    </item>
    <item>
      <title>Re: create a centerline by two points</title>
      <link>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12715366#M166262</link>
      <description>&lt;P&gt;Hi&amp;nbsp;&lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/7375074"&gt;@breinkemeyer&lt;/a&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes that would be a good way to tie a centerline to the model. You can also project a curve into the sketch and constrain the line to that curve.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a quick sample in VB.NET of just adding a sketchline and changing layer to Centerline.&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="visual-basic"&gt;Dim drawView As DrawingView = ThisApplication.CommandManager.Pick(SelectionFilterEnum.kDrawingViewFilter, "Select a drawing view")

Dim drawDoc As DrawingDocument= ThisApplication.ActiveDocument

Dim sketch1 As DrawingSketch = drawView.Sketches.Add   
sketch1.Edit

Dim startPt As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(0,0)
startPt = drawView.SheetToDrawingViewSpace(startPt)

Dim endPt As Point2d = ThisApplication.TransientGeometry.CreatePoint2d(216*2.54,0)
endPt = drawView.SheetToDrawingViewSpace(endPt)

Dim oLine As SketchLine = sketch1.SketchLines.AddByTwoPoints(startPt, endPt)
Dim layers As LayersEnumerator = drawDoc.StylesManager.Layers
oLine.Layer = layers.Item("Centerline (ANSI)")
sketch1.ExitEdit&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This isn't tied to any specific geometry, the centerline is just of the sheet.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="AAcheson_0-1713375332876.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1351150i21BA22984C0B70DC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="AAcheson_0-1713375332876.png" alt="AAcheson_0-1713375332876.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 17 Apr 2024 17:38:29 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/inventor-programming-ilogic/create-a-centerline-by-two-points/m-p/12715366#M166262</guid>
      <dc:creator>A.Acheson</dc:creator>
      <dc:date>2024-04-17T17:38:29Z</dc:date>
    </item>
  </channel>
</rss>

