Author Topic: Bricscad && .NET  (Read 90237 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #30 on: September 23, 2009, 11:07:58 AM »
Fixed a bug that could prevent commands from running,
added a new namespace RxNet.RxGlobal and added a few global functions  :-)

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #31 on: September 24, 2009, 08:58:32 AM »
I ran sandcastle on the runtime callable wrappers for Bricscad, I think it may be too big to attach to the installer as it 23mb. I may ask to post it at the Bricscad DEV site... if you need a copy, I can swamp-express it !?!

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Bricscad && .NET
« Reply #32 on: September 24, 2009, 04:30:19 PM »

huh ?

Bricscad uses ACAD classes ??

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: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #33 on: September 24, 2009, 06:29:09 PM »

huh ?

Bricscad uses ACAD classes ??




Those are aliases for code compatibility, I if I were to have scrolled down a bit before taking the snapshot they would have been prefixed with ODA

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Bricscad && .NET
« Reply #34 on: September 24, 2009, 07:33:01 PM »

Thanks Daniel .. that makes sense now :)
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: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #35 on: September 28, 2009, 01:32:34 AM »
made some changes for v1.0.0.6

Combined the V9 and V10 installers into a single installer that provides options on which version(s) to install.

Fixed a bug in the locating the RxLoader.txt file

wrapped a few more global functions
 :-)
 

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #36 on: September 30, 2009, 03:00:48 AM »
Added a few more global functions

Ecs2Ucs
Ecs2Wcs
Ucs2Ecs
Ucs2Wcs
Wcs2Ecs
Wcs2Ucs
Polar
DisplayPreviewFromDwg
etc.

Please uninstall, any previous versions before installing this version, This should be the last time we need to do this, after this new versions will overwrite the old, unless I goof

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #37 on: October 06, 2009, 11:13:40 PM »
Added support for V10 release  :-)

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #38 on: October 08, 2009, 07:48:40 AM »
just a test adding a menu to the newly released Bricscad v10  :-)

Code: [Select]
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Runtime.InteropServices;

using RxNet.ApplicationServices;
using RxNet.DatabaseServices;
using RxNet.Runtime;
using RxNet.Geometry;
using RxNet.RxGlobal;

using BricscadApp;
using BricscadDb;

namespace RxNet10Play
{
 public static class ExecMethods
 {
  [CommandMethod("MyMenu")]
  public static void mymenu()
  {
   try
   {
    AcadApplication app =
     Application.AcadApplication as AcadApplication;
    if (app == null)
     throw new Exception("Could Not Get Application");

    //a list of menu items and command names
    List<KeyValuePair<String, String>> menuItems =
       new List<KeyValuePair<string, string>>();

    menuItems.Add(new KeyValuePair<String,String>("Menu1","cmd1"));
    menuItems.Add(new KeyValuePair<String,String>("Menu2","cmd2"));
    menuItems.Add(new KeyValuePair<String,String>("Menu3","cmd3"));

    if (AddMenu("MyMenu", menuItems, app))
     GlobalFunctions.Printf("\ndone");

   }
   catch (Exception ex)
   {
    GlobalFunctions.Alert(
      String.Format("{0}\n{1}", ex.Message, ex.StackTrace));
   }
  }


  public static bool AddMenu(String menuName,
                      List<KeyValuePair<String, String>> items,
                      AcadApplication app)
  {
   // ToDo add error checking for arguments

   //get the index of the BRICSCAD menu group
   int index = 0;
   AcadMenuGroups currentGroups =
    app.MenuGroups as AcadMenuGroups;
   foreach (var item in currentGroups)
   {
    AcadMenuGroup grp = item as  AcadMenuGroup;
    if(grp.Name.Equals("BRICSCAD",
      StringComparison.CurrentCultureIgnoreCase))
     break;
    index++;
   }
 
   //get the menu group
   AcadMenuGroup currentGroup =
    app.MenuGroups.Item(index) as AcadMenuGroup;

   //run through the menu group to check if our group exists
   foreach (AcadPopupMenu item in currentGroup.Menus)
   {
    if (item.NameNoMnemonic.Equals(menuName,
     StringComparison.CurrentCultureIgnoreCase))
     return false;
   }

   // add our menu
   AcadPopupMenu menu =
    currentGroup.Menus.Add(menuName);

   // add the macros
   foreach (var item in items)
    menu.AddMenuItem(menu.Count, item.Key, item.Value);

   // insert the menu
   currentGroup.Menus.InsertMenuInMenuBar
          (menuName, currentGroup.Menus.Count);

   return true;
  }
 }
}



It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #39 on: November 10, 2009, 08:31:37 PM »
Fixed a few internal issues, no major changes, attached to the first post in this thread

Jerry J

  • Newt
  • Posts: 48
Re: Bricscad && .NET
« Reply #40 on: November 11, 2009, 05:01:39 AM »
Daniel,

I haven't tried your latest build, but I made a stupid mistake and downloaded C# 2010 Express and decided to try it in mid project.
Since I'm not a programmer, and sometimes I don't think ahead too far, I still should have known that C# 4.0 wasn't going to create
a dll that Bricscad could swallow.  The bare bones was running ok using C# 2008 Express and it compiled without errors with 2010 but..
choked at netload of my assembly.  My assembly is actually your sample with a couple added extensions, a commandmethod and some
tinkering with datagridview.  So I was wondering if you can compile and run your sample using your VS 2010.  Any comments are appreciated.

BTW I shelved the Excel project after finally getting it to run when I realized how slow the connection was.  Thinking about SQL still.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #41 on: November 11, 2009, 05:49:21 AM »
Jerry,
You can 'try' using this version (attached) with VS 2010 projects. I have not done a lot of testing with this version, so let me know how it works for you

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #42 on: December 13, 2009, 12:22:14 AM »
linq  8-)

Code: [Select]
  [CommandMethod("test01")]
  public static void test01()
  {
   var app = Application.AcadApplication as AcadApplication;
   var ents = app.ActiveDocument.ModelSpace.
     OfType<AcadLine>().Where(line => line.Length > 1.2);
   foreach (var e in ents)
    e.Layer = "0";
  }

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: Bricscad && .NET
« Reply #43 on: December 13, 2009, 01:23:06 AM »


 :-) :lol:
I was wondering when I'd be seeing something like that  ;-)
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: 8659
  • AKA Daniel
Re: Bricscad && .NET
« Reply #44 on: December 13, 2009, 06:34:35 PM »
Just having a bit of fun,  goofing with the new dynamic keyword a little.

Code: [Select]
  [CommandMethod("test02")]
  public static void test02()
  {
   var application = Application.AcadApplication as AcadApplication;

   var ents = application.ActiveDocument.ModelSpace.
    OfType<AcadBlockReference>().Where(item =>
     item.Name.Equals("*u31", StringComparison.CurrentCultureIgnoreCase)).ToList();

   var attrefs = new List<dynamic>();
   ents.ForEach(item => attrefs.AddRange((dynamic)item.GetAttributes()));

   attrefs.ForEach(item => application.ActiveDocument.
    Utility.Prompt(string.Format("\n{0}",item.TextString)));
  }