Author Topic: Bricscad Beta gets .NET!  (Read 5953 times)

0 Members and 1 Guest are viewing this topic.

Daniel Eiszele

  • Newt
  • Posts: 85
Bricscad Beta gets .NET!
« 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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Bricscad Beta gets .NET!
« Reply #1 on: April 19, 2011, 08:26:56 PM »

Daniel,
Is that Bricscad version 11.3.6-1 en_US (Beta)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Daniel Eiszele

  • Newt
  • Posts: 85
Re: Bricscad Beta gets .NET!
« Reply #2 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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Bricscad Beta gets .NET!
« Reply #3 on: April 20, 2011, 06:47:06 AM »
*woot*
and the SOLPROF COMMAND

added:
Just received the email notification ..
« Last Edit: April 20, 2011, 06:50:19 AM by Kerry »
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8696
  • AKA Daniel
Re: Bricscad Beta gets .NET!
« Reply #4 on: April 20, 2011, 07:10:30 AM »
It seems  pretty snappy too, time for me to get back in the .net game  :laugh:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Bricscad Beta gets .NET!
« Reply #5 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 :-)
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

Draftek

  • Guest
Re: Bricscad Beta gets .NET!
« Reply #6 on: April 20, 2011, 07:54:15 AM »
Figures!

I just committed to a large arx program..

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8696
  • AKA Daniel
Re: Bricscad Beta gets .NET!
« Reply #7 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);
      }
    }
  }
}
« Last Edit: April 20, 2011, 09:01:53 AM by __assume »

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8696
  • AKA Daniel
Re: Bricscad Beta gets .NET!
« Reply #8 on: April 20, 2011, 08:54:25 AM »
pretty snappy too

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8696
  • AKA Daniel
Re: Bricscad Beta gets .NET!
« Reply #9 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();
      }


mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: Bricscad Beta gets .NET!
« Reply #10 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.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions