TheSwamp

Code Red => .NET => Topic started by: Daniel Eiszele on April 19, 2011, 06:40:49 PM

Title: Bricscad Beta gets .NET!
Post by: Daniel Eiszele on April 19, 2011, 06:40:49 PM
Bricscad gets .NET in the latest beta.  Haven't played with it yet but it's just a little bit exciting  :lol:  Shouldn't be too long till it makes it to the bigtime.
Title: Re: Bricscad Beta gets .NET!
Post by: Kerry on April 19, 2011, 08:26:56 PM

Daniel,
Is that Bricscad version 11.3.6-1 en_US (Beta)
Title: Re: Bricscad Beta gets .NET!
Post by: Daniel Eiszele on April 19, 2011, 09:18:12 PM
Yep that's the one.  I compiled the provided examples in Sharp Develop and it ran without a hitch.
Title: Re: Bricscad Beta gets .NET!
Post by: Kerry on April 20, 2011, 06:47:06 AM
*woot*
and the SOLPROF COMMAND

added:
Just received the email notification ..
Title: Re: Bricscad Beta gets .NET!
Post by: It's Alive! on April 20, 2011, 07:10:30 AM
It seems  pretty snappy too, time for me to get back in the .net game  :laugh:
Title: Re: Bricscad Beta gets .NET!
Post by: Kerry on April 20, 2011, 07:14:38 AM
It seems  pretty snappy too, time for me to get back in the .net game  :laugh:

Me too .. now is a very opportune time :)

//-------
It's a while since I've fired up Bricscad ... had to ask for a new License Key :-)
Title: Re: Bricscad Beta gets .NET!
Post by: Draftek on April 20, 2011, 07:54:15 AM
Figures!

I just committed to a large arx program..
Title: Re: Bricscad Beta gets .NET!
Post by: It's Alive! on April 20, 2011, 08:51:53 AM
i'm the first  8-)

Code: [Select]
using System;
using System.Diagnostics;
using System.Collections.Generic;

using Teigha.Runtime;
using Teigha.DatabaseServices;
using Teigha.Geometry;

using Bricscad.ApplicationServices;
using Bricscad.Runtime;
using Bricscad.EditorInput;

using AcAp = Bricscad.ApplicationServices;
using AcDb = Teigha.DatabaseServices;
using AcGe = Teigha.Geometry;
using AcEd = Bricscad.EditorInput;

[assembly: CommandClass(typeof(CsDanTheMan.Commands))]

namespace CsDanTheMan
{
  public class Commands
  {
    [CommandMethod("doit")]
    static public void doitisay()
    {
      Editor editor = AcAp.Application.DocumentManager.MdiActiveDocument.Editor;
      try
      {
        Stopwatch sw = Stopwatch.StartNew();
        int bzillion = 100;
        Func<int, List<DBPoint>> pointMaker = delegate(int _bzillion)
        {
          var points = new List<DBPoint>(_bzillion * _bzillion * _bzillion);
          for (int i = 0; i < _bzillion; i++)
            for (int k = 0; k < _bzillion; k++)
              for (int l = 0; l < _bzillion; l++)
                points.Add(new DBPoint(new Point3d(i, k, l)));
          return points;
        };
        Func<BlockTableRecord, Transaction, Entity, ObjectId> actionHelper =
              delegate(BlockTableRecord _rec, Transaction _action, Entity _ent)
              {
                _action.AddNewlyCreatedDBObject(_ent, true);
                return _rec.AppendEntity(_ent);
              };
        var ids = new ObjectIdCollection();
        var database = HostApplicationServices.WorkingDatabase;
        var manager = database.TransactionManager;
        using (var action = manager.StartTransaction())
        {
          var blockTable =
              action.GetObject(database.BlockTableId, OpenMode.ForRead) as BlockTable;
          if (blockTable == null)
            return;
          var blockTableRecord =
              action.GetObject(blockTable[BlockTableRecord.ModelSpace],
                 OpenMode.ForWrite) as BlockTableRecord;
          if (blockTableRecord == null)
            return;
          var list = pointMaker.Invoke(bzillion);
          list.ForEach(point => ids.Add(actionHelper(blockTableRecord, action, point)));
          action.Commit();
          editor.WriteMessage("\n{0} Entities created in {1} Milliseconds",
                list.Count, sw.ElapsedMilliseconds);
        }
      }
      catch (System.Exception ex)
      {
        editor.WriteMessage("\nError: {0}\nStackTrace: {1}", ex.Message, ex.StackTrace);
      }
    }
  }
}
Title: Re: Bricscad Beta gets .NET!
Post by: It's Alive! on April 20, 2011, 08:54:25 AM
pretty snappy too
Title: Re: Bricscad Beta gets .NET!
Post by: It's Alive! on April 20, 2011, 09:25:45 AM
Code: [Select]
[CommandMethod("doit")]
    public void test()
    {
      Bitmap bitmap = new Bitmap("C:\\zot.bmp");
      Database db = AcAp.Application.DocumentManager.MdiActiveDocument.Database;
      using (Transaction tr = db.TransactionManager.StartTransaction())
      {
        AcDb.BlockTableRecord currentSpace = tr.GetObject
                        (db.CurrentSpaceId, OpenMode.ForWrite) as AcDb.BlockTableRecord;
        for (int i = 0; i < bitmap.Width; i++)
        {
          for (int j = 0; j < bitmap.Height; j++)
          {
            DBPoint point = new DBPoint();
            Teigha.Colors.Color color =
              Teigha.Colors.Color.FromColor(bitmap.GetPixel(i, j));
            point.Color = color;
            double z = (color.ColorValue.R + color.ColorValue.G + color.ColorValue.B) * 0.01;//change this
            point.Position = new Point3d(i, j, z);
            currentSpace.AppendEntity(point);
            tr.AddNewlyCreatedDBObject(point, true);
          }
        }
        tr.Commit();
      }

Title: Re: Bricscad Beta gets .NET!
Post by: mohnston on April 21, 2011, 06:41:33 PM
Is Bricscad built on OpenDesign API?
Wouldn't surprise me.
They (OpenDesign) have had .NET for dwgs for a while now.