Author Topic: ( C3D ) unable to create points  (Read 7430 times)

0 Members and 1 Guest are viewing this topic.

sinc

  • Guest
Re: ( C3D ) unable to create points
« Reply #15 on: January 22, 2007, 12:39:37 PM »
Thanks for the testing sinc. I knew I wasn't losing my mind when I started this thread. :-)

And you're sure of that... how?   :-D

sinc

  • Guest
Re: ( C3D ) unable to create points
« Reply #16 on: March 15, 2007, 10:15:57 PM »
Who knows, since this seems to be an ever changing program right now, it just may be revised again in the next release.

Well, I finally had enough of digging into the Point Settings in order to change the next point number.  So I added a NEXTPT routine.  It only took about 30 minutes - most of that writing the part that checks to see if the point number is already being used - and it means I don't have to wait for Autodesk to fix it.   :laugh:

It complements the FREEPT (list available point numbers) routine I posted yesterday.  I have NEXTPT aliased to NX, and FREEPT aliased to FR, so it's quick and easy to run either one.

A DLL is posted here.

Code: [Select]
/*
 * Created by Richard Sincovec
 * User: Sinc
 * Date: 3/15/2007
 * Time: 6:28 PM
 *
 */

using System;
using Autodesk.AutoCAD.ApplicationServices;
using Autodesk.AutoCAD.EditorInput;
using Autodesk.AutoCAD.Runtime;
using Autodesk.AECC.Interop.Land;
using Civil3DUtilities;

namespace Sincpac.PointNumbers
{
/// <summary>
/// Change the next point number in the Point Creation Settings.
/// </summary>
public class NextPointNumber
{
public NextPointNumber()
{
}

[CommandMethod("NEXTPT")]
public void NextPointNumberCommand()
{
C3DUtil c3dUtil = new C3DUtil();
Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
AeccSettingsPointCreation settings = c3dUtil.AeccDb.Settings.PointSettings.CreationSettings;
PromptIntegerOptions piops = new PromptIntegerOptions("\nNext point number:");
piops.DefaultValue = settings.NextPointNumber.Value;
piops.AllowZero = false;
piops.AllowNegative = false;
piops.AllowArbitraryInput = false;
PromptIntegerResult pires;
bool tryAgain = true;
do {
pires = ed.GetInteger(piops);
if (pires.Status == PromptStatus.OK) {
try {
AeccPoint pt = c3dUtil.AeccDb.Points.Find(pires.Value);
ed.WriteMessage("\nPoint {0} already exists!", pt.Number);
} catch {
settings.NextPointNumber.Value = pires.Value;
tryAgain = false;
}
}
} while (tryAgain && (pires.Status == PromptStatus.OK));
}
}
}