<?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 jig a Spline (fit points) using AutoCAD 2013 .NET API? in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3929709#M53717</link>
    <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can obtain the tangent angle from the first derivative of the curve with:&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt; MySpline.GetFirstDerivative(AtSomePoint)&lt;/FONT&gt;&lt;/STRONG&gt;, check the docs for others method that the curve class have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;</description>
    <pubDate>Mon, 20 May 2013 23:30:35 GMT</pubDate>
    <dc:creator>hgasty1001</dc:creator>
    <dc:date>2013-05-20T23:30:35Z</dc:date>
    <item>
      <title>How to jig a Spline (fit points) using AutoCAD 2013 .NET API?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3587416#M53713</link>
      <description>&lt;P&gt;How can I draw &lt;STRONG&gt;Spline&lt;/STRONG&gt; with &lt;STRONG&gt;fit points&lt;/STRONG&gt; in &lt;STRONG&gt;AutoCAD 2013&lt;/STRONG&gt; .NET API using my own &lt;STRONG&gt;jig&lt;/STRONG&gt;?&lt;/P&gt;</description>
      <pubDate>Mon, 20 Aug 2012 10:35:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3587416#M53713</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-20T10:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig a Spline (fit points) using AutoCAD 2013 .NET API?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3596930#M53714</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is a sample code that might help in getting started with jigging of spline. It is a modified version of the code from this blog post dealing with polyline jigging.&lt;/P&gt;
&lt;P&gt;&lt;A href="http://through-the-interface.typepad.com/through_the_interface/2010/12/jigging-an-autocad-polyline-with-arc-segments-using-net.html" target="_blank"&gt;http://through-the-interface.typepad.com/through_the_interface/2010/12/jigging-an-autocad-polyline-with-arc-segments-using-net.html&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Here is the code :&lt;/P&gt;
&lt;PRE&gt;using System;
using System.Windows.Forms;

using Autodesk.AutoCAD.Runtime;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.DatabaseServices;
using Autodesk.AutoCAD.Geometry;

[assembly: CommandClass(typeof(SplineJig.SplineJigCmds))]

namespace SplineJig
{
	public class SplineDrawJig : DrawJig
	{
		// members
		private Point3d _point;
		private Point3dCollection _points = new Point3dCollection();

		public Point3dCollection Coordinates
		{
			get
			{
				return _points;
			}
		}

		public SplineDrawJig()
		{
		}

		public void DoIt()
		{
			Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
			PromptResult jigRes = null;

			do
			{
				jigRes = ed.Drag(this);
				if (jigRes.Status == PromptStatus.OK)
				{
					_points.Add(_point);
				}
				else if (jigRes.Status == PromptStatus.None)
				{
					break;
				}
			}
			while (jigRes.Status == PromptStatus.OK);
		}

		protected override Autodesk.AutoCAD.EditorInput.SamplerStatus
		Sampler(Autodesk.AutoCAD.EditorInput.JigPrompts prompts)
		{
			JigPromptPointOptions jigOpts = new JigPromptPointOptions();

			jigOpts.UserInputControls = (UserInputControls.Accept3dCoordinates | UserInputControls.NullResponseAccepted);
			jigOpts.Message = "Select fit point: ";
			PromptPointResult jigRes = prompts.AcquirePoint(jigOpts);
			Point3d pt = jigRes.Value;

			if (pt == _point)
			{
				return SamplerStatus.NoChange;
			}
			_point = pt;
			if (jigRes.Status == PromptStatus.OK)
			{
				return SamplerStatus.OK;
			}
			return SamplerStatus.Cancel;
		}

		protected override bool WorldDraw(Autodesk.AutoCAD.GraphicsInterface.WorldDraw draw)
		{
			if (_points.Count == 0)
			{
				return true;
			}
			Point3dCollection vertices = new Point3dCollection();

			foreach (Point3d point in _points)
			{
				vertices.Add(point);
			}
			vertices.Add(_point);

			int totalVertices = vertices.Count;
			if(totalVertices &amp;gt;= 2)
			{
				Line chordLine = new Line(vertices[totalVertices - 1], vertices[totalVertices-2]);
				draw.Geometry.Draw(chordLine);
			}
 
			Spline spline = new Spline(vertices, KnotParameterizationEnum.Chord, 3, 0.0);
			draw.Geometry.Draw(spline);
			
			return true;
		}
	}

	public class SplineJigCmds
	{
		public SplineJigCmds() { }

		[CommandMethod("SplineJig")]
		static public void SplineJig()
		{
			try
			{
				Editor ed = Autodesk.AutoCAD.ApplicationServices.Application.DocumentManager.MdiActiveDocument.Editor;
				Database db = ed.Document.Database;
				SplineDrawJig splineJig = new SplineDrawJig();

				splineJig.DoIt();

				// order of the curve can be between 2 and 26
                int order = 6;
                // determines extent of interpolation through all the points 
                double fitTolerance = .5;

				Spline spline = new Spline(splineJig.Coordinates, KnotParameterizationEnum.Chord, 3, 0.0);
				using (Transaction tr = db.TransactionManager.StartTransaction())
				{
					BlockTableRecord btr = (BlockTableRecord)tr.GetObject(db.CurrentSpaceId, OpenMode.ForWrite);

					btr.AppendEntity(spline);
					tr.AddNewlyCreatedDBObject(spline, true);
					tr.Commit();
				}
			}
			catch (System.Exception ex)
			{
				MessageBox.Show(ex.Message, "Exception", MessageBoxButtons.OK, MessageBoxIcon.Error);
			}
		}
	}
}&lt;/PRE&gt;
&lt;P&gt;&amp;nbsp;Hope this helps.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 27 Aug 2012 17:02:54 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3596930#M53714</guid>
      <dc:creator>Balaji_Ram</dc:creator>
      <dc:date>2012-08-27T17:02:54Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig a Spline (fit points) using AutoCAD 2013 .NET API?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3597658#M53715</link>
      <description>&lt;P&gt;&lt;SPAN&gt;Thank You for answer. Perfect solution!&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Aug 2012 07:40:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3597658#M53715</guid>
      <dc:creator>Anonymous</dc:creator>
      <dc:date>2012-08-28T07:40:58Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig a Spline (fit points) using AutoCAD 2013 .NET API?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3929660#M53716</link>
      <description>&lt;P&gt;I'd like to add an rotated entity to the ends of the spline.&lt;/P&gt;&lt;P&gt;The&amp;nbsp;Spline.StartFitTangent is giving a result of (0,0,0)&lt;/P&gt;&lt;P&gt;Is there another way of getting the angle of the start and endpoints?&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2013 21:58:15 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3929660#M53716</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2013-05-20T21:58:15Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig a Spline (fit points) using AutoCAD 2013 .NET API?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3929709#M53717</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;you can obtain the tangent angle from the first derivative of the curve with:&lt;STRONG&gt;&lt;FONT color="#0000FF"&gt; MySpline.GetFirstDerivative(AtSomePoint)&lt;/FONT&gt;&lt;/STRONG&gt;, check the docs for others method that the curve class have.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Gaston Nunez&lt;/P&gt;</description>
      <pubDate>Mon, 20 May 2013 23:30:35 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3929709#M53717</guid>
      <dc:creator>hgasty1001</dc:creator>
      <dc:date>2013-05-20T23:30:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to jig a Spline (fit points) using AutoCAD 2013 .NET API?</title>
      <link>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3930401#M53718</link>
      <description>&lt;P&gt;Thanks Gaston!&lt;/P&gt;</description>
      <pubDate>Tue, 21 May 2013 15:02:51 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/how-to-jig-a-spline-fit-points-using-autocad-2013-net-api/m-p/3930401#M53718</guid>
      <dc:creator>SRSDS</dc:creator>
      <dc:date>2013-05-21T15:02:51Z</dc:date>
    </item>
  </channel>
</rss>

