Author Topic: DevTV: Introductory recordings on Autodesk APIs  (Read 18206 times)

0 Members and 1 Guest are viewing this topic.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8691
  • AKA Daniel

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #1 on: November 03, 2007, 08:48:41 PM »

ta !
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.

jmaeding

  • Bull Frog
  • Posts: 304
  • I'm just here for the Shelties.
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #2 on: November 05, 2007, 02:00:31 PM »
wow, check out the one by Fenton.  I had no idea we could do all that, the can of worms is open now!
James Maeding

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #3 on: November 05, 2007, 05:57:37 PM »
........  the can of worms is open now!
Sorry James ,you lost me ?
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.

vegbruiser

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #4 on: November 06, 2007, 07:57:50 AM »
Hi there folks, I'm new here so I thought I'd my $0.02 to this post: -

EDIT: Me again  :-o

After further experimentation it would appear the "keywordoptions" I mentioned previously are very case-sensitive.  :oops:
« Last Edit: November 10, 2007, 05:40:03 AM by vegbruiser »

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8691
  • AKA Daniel
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #5 on: November 10, 2007, 08:58:28 AM »
Hi there folks, I'm new here so I thought I'd my $0.02 to this post: -

EDIT: Me again  :-o

After further experimentation it would appear the "keywordoptions" I mentioned previously are very case-sensitive.  :oops:

Welcome vegbruiser.   C# or VB ?

vegbruiser

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #6 on: November 10, 2007, 10:33:07 AM »
VB.

It's Alive!

  • Retired
  • Needs a day job
  • Posts: 8691
  • AKA Daniel
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #7 on: November 10, 2007, 10:49:14 AM »
Glenn . We have another that’s needs converting, Do your stuff!  :police:

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #8 on: November 13, 2007, 11:32:38 PM »
So much for "Conversion from Vb to C# is Simple .. " [*cough]
.. bloody mickeyMouse languages without curley braces twist my nickers something awefull ..
Converted with SharpDevelop 2.2


Warning   1   Missing XML comment for publicly visible type or member 'UserControl1'   ....\UserControl1.Designer.cs   2   15   DevTvIntro.Converted
Warning   2   Missing XML comment for publicly visible type or member 'UserControl1.Dispose(bool)'   ....\UserControl1.Designer.cs   7   26   DevTvIntro.Converted
Warning   3   Missing XML comment for publicly visible type or member 'adskClass'   ....\Class.cs   29   14   DevTvIntro.Converted
Error   4   The name 'Constants' does not exist in the current context   ....\Class.cs   40   24   DevTvIntro.Converted
Error   5   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.BlockTableRecord'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   93   32   DevTvIntro.Converted
Error   6   Cannot convert method group 'StartTransaction' to non-delegate type 'Autodesk.AutoCAD.DatabaseServices.Transaction'. Did you intend to invoke the method?   ....\Class.cs   132   27   DevTvIntro.Converted
Error   7   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.BlockTable'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   142   32   DevTvIntro.Converted
Error   8   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.BlockTableRecord'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   185   36   DevTvIntro.Converted
Warning   9   Missing XML comment for publicly visible type or member 'adskClass.myPaletteSet'   ....\Class.cs   215   45   DevTvIntro.Converted
Warning   10   Missing XML comment for publicly visible type or member 'adskClass.myPalette'   ....\Class.cs   217   22   DevTvIntro.Converted
Error   11   The type or namespace name 'Guid' could not be found (are you missing a using directive or an assembly reference?)   ....\Class.cs   228   77   DevTvIntro.Converted
Error   12   The best overloaded method match for 'Autodesk.AutoCAD.Windows.PaletteSet.PaletteSet(string, System.Guid)' has some invalid arguments   ....\Class.cs   228   19   DevTvIntro.Converted
Error   13   Argument '2': cannot convert from 'Guid' to 'System.Guid'   ....\Class.cs   228   73   DevTvIntro.Converted
Error   14   The name 'Constants' does not exist in the current context   ....\Class.cs   251   20   DevTvIntro.Converted
Error   15   The type or namespace name 'Forms' could not be found (are you missing a using directive or an assembly reference?)   ....\Class.cs   282   13   DevTvIntro.Converted
Error   16   The type or namespace name 'Forms' could not be found (are you missing a using directive or an assembly reference?)   ....\Class.cs   304   3   DevTvIntro.Converted
Error   17   The type or namespace name 'Forms' could not be found (are you missing a using directive or an assembly reference?)   ....\Class.cs   314   12   DevTvIntro.Converted
Error   18   Cannot convert method group 'StartTransaction' to non-delegate type 'Autodesk.AutoCAD.DatabaseServices.Transaction'. Did you intend to invoke the method?   ....\Class.cs   337   24   DevTvIntro.Converted
Error   19   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.Entity'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   341   18   DevTvIntro.Converted
Error   20   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.DBDictionary'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   353   34   DevTvIntro.Converted
Error   21   The name 'ControlChars' does not exist in the current context   ....\Class.cs   362   22   DevTvIntro.Converted
Error   22   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.Xrecord'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   366   18   DevTvIntro.Converted
Error   23   The name 'ControlChars' does not exist in the current context   ....\Class.cs   369   23   DevTvIntro.Converted
Error   24   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.TypedValue.TypedValue(int, object)' has some invalid arguments   ....\Class.cs   380   43   DevTvIntro.Converted
Error   25   Argument '1': cannot convert from 'Autodesk.AutoCAD.DatabaseServices.DxfCode' to 'int'   ....\Class.cs   380   58   DevTvIntro.Converted
Error   26   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.TypedValue.TypedValue(int, object)' has some invalid arguments   ....\Class.cs   380   77   DevTvIntro.Converted
Error   27   Argument '1': cannot convert from 'Autodesk.AutoCAD.DatabaseServices.DxfCode' to 'int'   ....\Class.cs   380   92   DevTvIntro.Converted
Error   28   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.TypedValue.TypedValue(int, object)' has some invalid arguments   ....\Class.cs   380   122   DevTvIntro.Converted
Error   29   Argument '1': cannot convert from 'Autodesk.AutoCAD.DatabaseServices.DxfCode' to 'int'   ....\Class.cs   380   137   DevTvIntro.Converted
Error   30   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.TypedValue.TypedValue(int, object)' has some invalid arguments   ....\Class.cs   380   158   DevTvIntro.Converted
Error   31   Argument '1': cannot convert from 'Autodesk.AutoCAD.DatabaseServices.DxfCode' to 'int'   ....\Class.cs   380   173   DevTvIntro.Converted
Error   32   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.TypedValue.TypedValue(int, object)' has some invalid arguments   ....\Class.cs   380   195   DevTvIntro.Converted
Error   33   Argument '1': cannot convert from 'Autodesk.AutoCAD.DatabaseServices.DxfCode' to 'int'   ....\Class.cs   380   210   DevTvIntro.Converted
Error   34   The type or namespace name 'Forms' could not be found (are you missing a using directive or an assembly reference?)   ....\Class.cs   394   16   DevTvIntro.Converted
Error   35   The type or namespace name 'Forms' could not be found (are you missing a using directive or an assembly reference?)   ....\Class.cs   399   9   DevTvIntro.Converted
Error   36   Cannot convert method group 'StartTransaction' to non-delegate type 'Autodesk.AutoCAD.DatabaseServices.Transaction'. Did you intend to invoke the method?   ....\Class.cs   437   23   DevTvIntro.Converted
Error   37   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.DBDictionary'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   441   23   DevTvIntro.Converted
Error   38   The name 'ControlChars' does not exist in the current context   ....\Class.cs   450   21   DevTvIntro.Converted
Error   39   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.Xrecord'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   454   17   DevTvIntro.Converted
Error   40   The name 'ControlChars' does not exist in the current context   ....\Class.cs   457   22   DevTvIntro.Converted
Error   41   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.TypedValue.TypedValue(int, object)' has some invalid arguments   ....\Class.cs   468   42   DevTvIntro.Converted
Error   42   Argument '1': cannot convert from 'Autodesk.AutoCAD.DatabaseServices.DxfCode' to 'int'   ....\Class.cs   468   57   DevTvIntro.Converted
Error   43   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.TypedValue.TypedValue(int, object)' has some invalid arguments   ....\Class.cs   468   76   DevTvIntro.Converted
Error   44   Argument '1': cannot convert from 'Autodesk.AutoCAD.DatabaseServices.DxfCode' to 'int'   ....\Class.cs   468   91   DevTvIntro.Converted
Error   45   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.TypedValue.TypedValue(int, object)' has some invalid arguments   ....\Class.cs   468   134   DevTvIntro.Converted
Error   46   Argument '1': cannot convert from 'Autodesk.AutoCAD.DatabaseServices.DxfCode' to 'int'   ....\Class.cs   468   149   DevTvIntro.Converted
Error   47   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.TypedValue.TypedValue(int, object)' has some invalid arguments   ....\Class.cs   468   170   DevTvIntro.Converted
Error   48   Argument '1': cannot convert from 'Autodesk.AutoCAD.DatabaseServices.DxfCode' to 'int'   ....\Class.cs   468   185   DevTvIntro.Converted
Error   49   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.TypedValue.TypedValue(int, object)' has some invalid arguments   ....\Class.cs   468   207   DevTvIntro.Converted
Error   50   Argument '1': cannot convert from 'Autodesk.AutoCAD.DatabaseServices.DxfCode' to 'int'   ....\Class.cs   468   222   DevTvIntro.Converted
Error   51   Cannot implicitly convert type 'int' to 'bool'   ....\Class.cs   511   8   DevTvIntro.Converted
Error   52   Cannot convert method group 'StartTransaction' to non-delegate type 'Autodesk.AutoCAD.DatabaseServices.Transaction'. Did you intend to invoke the method?   ....\Class.cs   515   24   DevTvIntro.Converted
Error   53   'fullEntPath' is a 'variable' but is used like a 'method'   ....\Class.cs   519   34   DevTvIntro.Converted
Error   54   The name 'Drawing' does not exist in the current context   ....\Class.cs   524   90   DevTvIntro.Converted
Error   55   The name 'Drawing' does not exist in the current context   ....\Class.cs   525   87   DevTvIntro.Converted
Error   56   The type or namespace name 'Forms' could not be found (are you missing a using directive or an assembly reference?)   ....\Class.cs   530   14   DevTvIntro.Converted
Error   57   Cannot implicitly convert type 'Autodesk.AutoCAD.EditorInput.PointHistoryBits' to 'bool'   ....\Class.cs   570   8   DevTvIntro.Converted
Error   58   Cannot implicitly convert type 'int' to 'bool'   ....\Class.cs   630   8   DevTvIntro.Converted
Error   59   Cannot convert method group 'StartTransaction' to non-delegate type 'Autodesk.AutoCAD.DatabaseServices.Transaction'. Did you intend to invoke the method?   ....\Class.cs   634   24   DevTvIntro.Converted
Error   60   'fullEntPath' is a 'variable' but is used like a 'method'   ....\Class.cs   638   33   DevTvIntro.Converted
Error   61   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.DBDictionary'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   645   35   DevTvIntro.Converted
Error   62   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.Xrecord'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   654   18   DevTvIntro.Converted
Error   63   Operator '==' cannot be applied to operands of type 'short' and 'Autodesk.AutoCAD.DatabaseServices.DxfCode'   ....\Class.cs   658   12   DevTvIntro.Converted
Error   64   The best overloaded method match for 'Autodesk.AutoCAD.DatabaseServices.Curve.GetPointAtDist(double)' has some invalid arguments   ....\Class.cs   663   22   DevTvIntro.Converted
Error   65   Argument '1': cannot convert from 'object' to 'double'   ....\Class.cs   663   41   DevTvIntro.Converted
Error   66   Cannot convert method group 'StartTransaction' to non-delegate type 'Autodesk.AutoCAD.DatabaseServices.Transaction'. Did you intend to invoke the method?   ....\Class.cs   852   23   DevTvIntro.Converted
Error   67   Cannot implicitly convert type 'Autodesk.AutoCAD.DatabaseServices.DBObject' to 'Autodesk.AutoCAD.DatabaseServices.BlockTableRecord'. An explicit conversion exists (are you missing a cast?)   ....\Class.cs   856   36   DevTvIntro.Converted
Warning   68   Missing XML comment for publicly visible type or member 'adskClass.MyCircleJig'   ....\Class.cs   705   15   DevTvIntro.Converted
Error   69   A local variable named 'jigPromptResult' is already defined in this scope   ....\Class.cs   768   25   DevTvIntro.Converted
Error   70   Cannot implicitly convert type 'Autodesk.AutoCAD.EditorInput.PromptDoubleResult' to 'Autodesk.AutoCAD.EditorInput.PromptPointResult'   ....\Class.cs   768   43   DevTvIntro.Converted
Error   71   Cannot implicitly convert type 'Autodesk.AutoCAD.Geometry.Point3d' to 'double'   ....\Class.cs   774   16   DevTvIntro.Converted
Error   72   'adskClass.MyCircleJig.Update()': not all code paths return a value   ....\Class.cs   799   27   DevTvIntro.Converted
Warning   73   Missing XML comment for publicly visible type or member 'adskClass.MyCircleJig.CurrentInput'   ....\Class.cs   714   14   DevTvIntro.Converted
Warning   74   '42016' is not a valid warning number   DevTvIntro.Converted
« Last Edit: November 15, 2007, 07:08:41 AM by Kerry Brown »
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #9 on: November 13, 2007, 11:40:36 PM »
So much for "Conversion from Vb to C# is Simple .. " [*cough]
.. bloody mickeyMouse languages without curley braces twist my nickers something awefull ..

Poorly written converter or original source code? Or both? Personally I enjoy the idiosyncrasies of many languages, even the, errrm basic derivatives.

Edit: That does look awful tho.
« Last Edit: November 13, 2007, 11:41:55 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #10 on: November 14, 2007, 01:22:14 AM »

I'm going back and starting over ..
Make sure the build in VB builds,netloads,works ..
.. then convert.

I've had this discussion previously and AutoDesk are quite happy to have everyone do their own conversions.
If you've tried to convert come of the SDK samples you'll know that some of the VB code does not convert.
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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #11 on: November 14, 2007, 08:51:47 PM »
I've tried again, and the errors/warnings continue.

I have no expectation that they would produce a recording for C#, but I'm astounded that AutoDesk have not provided a buildable C# solution.

Some of us don't have the time or inclination to learn the idiosyncracies of VB to the level required to make the translation.

This was s'posed to be a tutor, and ignoring half their potential audience doesn't seem to be aligned with their ascribed goal.

 I've posted my thoughts on the blog, but doubt that a single voice will provide much incentive for remedial action on their part

... but Ive been wrong before :-)

added: The Revit Samples DO have both VB and CS code included ....
« Last Edit: November 14, 2007, 08:55:56 PM by Kerry Brown »
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.

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #12 on: November 14, 2007, 09:05:44 PM »
I share with you the surprise and disappointment the powers that be failed to recognize the value and importance of providing all sample solutions in professionally written C#.

Edit: As shown. If you think about it they've never supplied professional level code / solutions. Not for LISP, not for VB, not for C#.
« Last Edit: November 14, 2007, 09:10:47 PM by MP »
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #13 on: November 14, 2007, 09:29:50 PM »

'never' is a big word .. but I'm disinclined to find a more suitable one ..
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.

TR

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #14 on: November 14, 2007, 11:36:44 PM »
So you really can't look at VB.NET code and figure out how it should be done in C#?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #15 on: November 14, 2007, 11:55:55 PM »
Yes, It can be done ..
just a bit tricky when dealing with new concepts ..

and I don't have the time at the moment.

the real waste is that EVERYONE who wants to play with C# has to translate the code,
and that may proove a little difficult for newb's ...

Michael's use of the "P" word covers it nicely
Quote
.. professionally written C# (sample)....




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.

Nathan Taylor

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #16 on: November 15, 2007, 01:23:17 AM »
Lucky I ignored eveyones advice on C#.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #17 on: November 15, 2007, 05:24:49 AM »
Anyone .. ?
I've wittled them down from 74 to 8 to 3

Some of the fixups may be less than perfect .. I'm a little brain dead :-)

Quote
Error   4   'fullEntPath' is a 'variable' but is used like a 'method'
Quote
 ... fixed


added:
and the 2 solutions ZIP FILES REMOVED :-
« Last Edit: November 15, 2007, 09:48:51 AM by Kerry Brown »
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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #18 on: November 15, 2007, 05:50:33 AM »
Any VB'rs know why these warnings would be suppressed ... ( I bite my tongue)

Quote
Warning   9   '42016' is not a valid warning number   DevTvIntro
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: 8691
  • AKA Daniel
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #19 on: November 15, 2007, 09:10:41 AM »
Kerry, please look at this one.. don't have much time to play as I have family visiting this week

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #20 on: November 15, 2007, 09:28:26 AM »
Thanks Dan .. That seems to do the trick .... I couldn't see the trees for the forest !

Haven't tested all .. but it compiles, netloads and runs 'helloworld' :-)

I'm off to bed !

ta man !
« Last Edit: November 15, 2007, 09:36:41 AM by Kerry Brown »
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.

Glenn R

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #21 on: November 15, 2007, 08:20:06 PM »
I'm sorry I missed this Kerry. I didn't realise you were posting questions about the source code.
Are you still having trouble? If so, let me know and when I get back from breakfast (I'm in Singapore at the moment) I'll have a go at rewriting it for you and anybody else.

Cheers,
Glenn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #22 on: November 15, 2007, 08:32:49 PM »
Hi Glenn,
sorry I missed the send -off !

The code Dan posted compiles, netloads and runs the simple stuff.
however,
After the Palette and addDBEvents Commands are run the TreeView is not visible on the pallete and subsequent drawing additions crash Acad.

I'm running in 3 directions at once , so if you have a moment between drinks and pestering hosties ...
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.

Glenn R

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #23 on: November 15, 2007, 08:44:25 PM »
I'm running in 3 directions at once

Neat trick ;)

I'll see what I can do...the view is quite exceptional...<wanders off>

MP

  • Seagull
  • Posts: 17750
  • Have thousands of dwgs to process? Contact me.
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #24 on: November 15, 2007, 08:47:35 PM »
I'm running in 3 directions at once

Kerry's a triathlete?
Engineering Technologist • CAD Automation Practitioner
Automation ▸ Design ▸ Drafting ▸ Document Control ▸ Client
cadanalyst@gmail.com • http://cadanalyst.slack.com • http://linkedin.com/in/cadanalyst

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #25 on: November 15, 2007, 08:58:08 PM »
>>  triathlete

 :lmao:
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: 8691
  • AKA Daniel
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #26 on: November 15, 2007, 09:43:46 PM »
Try this one, it seems the controls didn’t get translated correctly

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #27 on: November 15, 2007, 10:47:42 PM »

quick Test ... seems to hold together Dan.

I'll have a look tonight. Thanks heaps!



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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #28 on: November 15, 2007, 10:59:03 PM »

I've just had one of 'those' thoughts ...

I wonder if doing the translation from VB to C# with Lutz Roeder's Reflector would be more efficient and accurate than using SharpDevelop ??

[addToListOfThingsToTest]
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.

LE

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #29 on: November 15, 2007, 11:55:34 PM »
Do not know what of the demos you guys are using.... I download the first one on the list and opened on visual studio 2005, removed the debug to a2008, did the compile and open it using lutz reflector and getting something like:

Code: [Select]
[CommandMethod("addAnEnt")]
public void AddAnEnt()
{
    Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
    PromptKeywordOptions getWhichEntityOptions = new PromptKeywordOptions("Which entity do you want to create? [Circle/Block] : ", "Circle Block");
    PromptResult getWhichEntityResult = ed.GetKeywords(getWhichEntityOptions);
    if (getWhichEntityResult.Status == PromptStatus.OK)
    {
        switch (getWhichEntityResult.StringResult)
        {
            case "Circle":
            {
                PromptPointOptions getPointOptions = new PromptPointOptions("Pick Center Point : ");
                PromptPointResult getPointResult = ed.GetPoint(getPointOptions);
                if (getPointResult.Status == PromptStatus.OK)
                {
                    PromptDistanceOptions getRadiusOptions = new PromptDistanceOptions("Pick Radius : ");
                    getRadiusOptions.BasePoint = getPointResult.Value;
                    getRadiusOptions.UseBasePoint = true;
                    PromptDoubleResult getRadiusResult = ed.GetDistance(getRadiusOptions);
                    if (getRadiusResult.Status == PromptStatus.OK)
                    {
                        Database dwg = ed.Document.Database;
                        Transaction trans = dwg.TransactionManager.StartTransaction();
                        try
                        {
                            Circle circle = new Circle(getPointResult.Value, Vector3d.ZAxis, getRadiusResult.Value);
                            ((BlockTableRecord) trans.GetObject(dwg.CurrentSpaceId, OpenMode.ForWrite)).AppendEntity(circle);
                            trans.AddNewlyCreatedDBObject(circle, true);
                            trans.Commit();
                        }
                        catch (Exception exception1)
                        {
                            ProjectData.SetProjectError(exception1);
                            Exception ex = exception1;
                            ed.WriteMessage("problem due to " + ex.Message);
                            ProjectData.ClearProjectError();
                        }
                        finally
                        {
                            trans.Dispose();
                        }
                    }
                }
                break;
            }
            case "Block":
            {
                PromptStringOptions blockNameOptions = new PromptStringOptions("Enter name of the Block to create : ");
                blockNameOptions.AllowSpaces = false;
                PromptResult blockNameResult = ed.GetString(blockNameOptions);
                if (blockNameResult.Status == PromptStatus.OK)
                {
                    Database dwg = ed.Document.Database;
                    Transaction trans = dwg.TransactionManager.StartTransaction();
                    try
                    {
                        BlockTableRecord newBlockDef = new BlockTableRecord();
                        newBlockDef.Name = blockNameResult.StringResult;
                        BlockTable blockTable = (BlockTable) trans.GetObject(dwg.BlockTableId, OpenMode.ForRead);
                        if (!blockTable.Has(blockNameResult.StringResult))
                        {
                            blockTable.UpgradeOpen();
                            blockTable.Add(newBlockDef);
                            trans.AddNewlyCreatedDBObject(newBlockDef, true);
                        }
                        Point3d VB$t_struct$S0 = new Point3d(0.0, 0.0, 0.0);
                        Circle circle1 = new Circle(VB$t_struct$S0, Vector3d.ZAxis, 10.0);
                        VB$t_struct$S0 = new Point3d(20.0, 10.0, 0.0);
                        Circle circle2 = new Circle(VB$t_struct$S0, Vector3d.ZAxis, 10.0);
                        VB$t_struct$S0 = new Point3d(40.0, 20.0, 0.0);
                        Circle circle3 = new Circle(VB$t_struct$S0, Vector3d.ZAxis, 10.0);
                        VB$t_struct$S0 = new Point3d(60.0, 30.0, 0.0);
                        Circle circle4 = new Circle(VB$t_struct$S0, Vector3d.ZAxis, 10.0);
                        VB$t_struct$S0 = new Point3d(80.0, 40.0, 0.0);
                        Circle circle5 = new Circle(VB$t_struct$S0, Vector3d.ZAxis, 10.0);
                        newBlockDef.AppendEntity(circle1);
                        newBlockDef.AppendEntity(circle2);
                        newBlockDef.AppendEntity(circle3);
                        newBlockDef.AppendEntity(circle4);
                        newBlockDef.AppendEntity(circle5);
                        trans.AddNewlyCreatedDBObject(circle1, true);
                        trans.AddNewlyCreatedDBObject(circle2, true);
                        trans.AddNewlyCreatedDBObject(circle3, true);
                        trans.AddNewlyCreatedDBObject(circle4, true);
                        trans.AddNewlyCreatedDBObject(circle5, true);
                        PromptPointOptions blockRefPointOptions = new PromptPointOptions("Pick insertion point of Block : ");
                        PromptPointResult blockRefPointResult = ed.GetPoint(blockRefPointOptions);
                        if (blockRefPointResult.Status != PromptStatus.OK)
                        {
                            trans.Dispose();
                        }
                        else
                        {
                            BlockReference blockRef = new BlockReference(blockRefPointResult.Value, newBlockDef.ObjectId);
                            ((BlockTableRecord) trans.GetObject(dwg.CurrentSpaceId, OpenMode.ForWrite)).AppendEntity(blockRef);
                            trans.AddNewlyCreatedDBObject(blockRef, true);
                            trans.Commit();
                        }
                    }
                    catch (Exception exception2)
                    {
                        ProjectData.SetProjectError(exception2);
                        Exception ex = exception2;
                        ed.WriteMessage("a problem occured because " + ex.Message);
                        ProjectData.ClearProjectError();
                    }
                    finally
                    {
                        trans.Dispose();
                    }
                }
                break;
            }
        }
    }
}

[CommandMethod("addData")]
public void addData()
{
    Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
    PromptEntityResult getEntityResult = ed.GetEntity("Pick an entity to add an Extension Dictionary to : ");
    if (getEntityResult.Status == PromptStatus.OK)
    {
        Transaction trans = ed.Document.Database.TransactionManager.StartTransaction();
        try
        {
            Entity ent = (Entity) trans.GetObject(getEntityResult.ObjectId, OpenMode.ForRead);
            if (ent.ExtensionDictionary.IsNull)
            {
                ent.UpgradeOpen();
                ent.CreateExtensionDictionary();
            }
            DBDictionary extensionDict = (DBDictionary) trans.GetObject(ent.ExtensionDictionary, OpenMode.ForRead);
            try
            {
                ObjectId entryId = extensionDict.GetAt("MyData");
                ed.WriteMessage("\nThis entity already has data...");
                Xrecord myXrecord = (Xrecord) trans.GetObject(entryId, OpenMode.ForRead);
                foreach (TypedValue value in myXrecord.Data)
                {
                    ed.WriteMessage("\n" + value.TypeCode.ToString() + " . " + value.Value.ToString());
                }
            }
            catch (Exception exception1)
            {
                ProjectData.SetProjectError(exception1);
                extensionDict.UpgradeOpen();
                Xrecord myXrecord = new Xrecord();
                TypedValue[] VB$t_array$S0 = new TypedValue[5];
                TypedValue VB$t_struct$S1 = new TypedValue(70, 1);
                VB$t_array$S0[0] = VB$t_struct$S1;
                TypedValue VB$t_struct$S2 = new TypedValue(1, "MyStockData");
                VB$t_array$S0[1] = VB$t_struct$S2;
                TypedValue VB$t_struct$S3 = new TypedValue(40, 51.9);
                VB$t_array$S0[2] = VB$t_struct$S3;
                TypedValue VB$t_struct$S4 = new TypedValue(40, 100.0);
                VB$t_array$S0[3] = VB$t_struct$S4;
                TypedValue VB$t_struct$S5 = new TypedValue(40, 320.6);
                VB$t_array$S0[4] = VB$t_struct$S5;
                ResultBuffer data = new ResultBuffer(VB$t_array$S0);
                myXrecord.Data = data;
                extensionDict.SetAt("MyData", myXrecord);
                trans.AddNewlyCreatedDBObject(myXrecord, true);
                if (this.myPalette != null)
                {
                    try
                    {
                        foreach (TreeNode node in this.myPalette.TreeView1.Nodes)
                        {
                            if (Operators.ConditionalCompareObjectEqual(node.Tag, ent.ObjectId.ToString(), false))
                            {
                                TreeNode childNode = node.Nodes.Add("Extension Dictionary");
                                foreach (TypedValue value in myXrecord.Data)
                                {
                                    childNode.Nodes.Add(value.ToString());
                                }
                                goto Label_0302;
                            }
                        }
                    }
                    finally
                    {
                        IEnumerator VB$t_ref$L1;
                        if (VB$t_ref$L1 is IDisposable)
                        {
                            (VB$t_ref$L1 as IDisposable).Dispose();
                        }
                    }
                }
            Label_0302:
                ProjectData.ClearProjectError();
            }
            trans.Commit();
        }
        catch (Exception exception2)
        {
            ProjectData.SetProjectError(exception2);
            Exception ex = exception2;
            ed.WriteMessage("a problem occured because " + ex.Message);
            ProjectData.ClearProjectError();
        }
        finally
        {
            trans.Dispose();
        }
    }
}

[CommandMethod("addDataToNOD")]
public void addDataToNOD()
{
    Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
    Transaction trans = ed.Document.Database.TransactionManager.StartTransaction();
    try
    {
        DBDictionary nod = (DBDictionary) trans.GetObject(ed.Document.Database.NamedObjectsDictionaryId, OpenMode.ForRead);
        try
        {
            ObjectId entryId = nod.GetAt("MyData");
            ed.WriteMessage("\nThis entity already has data...");
            Xrecord myXrecord = (Xrecord) trans.GetObject(entryId, OpenMode.ForRead);
            foreach (TypedValue value in myXrecord.Data)
            {
                ed.WriteMessage("\n" + value.TypeCode.ToString() + " . " + value.Value.ToString());
            }
        }
        catch (Exception exception1)
        {
            ProjectData.SetProjectError(exception1);
            nod.UpgradeOpen();
            Xrecord myXrecord = new Xrecord();
            TypedValue[] VB$t_array$S0 = new TypedValue[5];
            TypedValue VB$t_struct$S0 = new TypedValue(70, 1);
            VB$t_array$S0[0] = VB$t_struct$S0;
            TypedValue VB$t_struct$S1 = new TypedValue(1, "MyCompanyDefaultSettings");
            VB$t_array$S0[1] = VB$t_struct$S1;
            TypedValue VB$t_struct$S2 = new TypedValue(40, 51.9);
            VB$t_array$S0[2] = VB$t_struct$S2;
            TypedValue VB$t_struct$S3 = new TypedValue(40, 100.0);
            VB$t_array$S0[3] = VB$t_struct$S3;
            TypedValue VB$t_struct$S4 = new TypedValue(40, 320.6);
            VB$t_array$S0[4] = VB$t_struct$S4;
            ResultBuffer data = new ResultBuffer(VB$t_array$S0);
            myXrecord.Data = data;
            nod.SetAt("MyData", myXrecord);
            trans.AddNewlyCreatedDBObject(myXrecord, true);
            ProjectData.ClearProjectError();
        }
        trans.Commit();
    }
    catch (Exception exception2)
    {
        ProjectData.SetProjectError(exception2);
        Exception ex = exception2;
        ed.WriteMessage("a problem occurred because " + ex.Message);
        ProjectData.ClearProjectError();
    }
    finally
    {
        trans.Dispose();
    }
}

Glenn R

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #30 on: November 16, 2007, 12:42:44 AM »
All that VB nastiness!

Glenn R

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #31 on: November 16, 2007, 12:43:21 AM »
Give this a whirl Kerry.

Glenn R

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #32 on: November 16, 2007, 12:54:32 AM »
Just thought I should post the solution as well because of the UserControl.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #33 on: November 16, 2007, 01:57:52 AM »

I've just had one of 'those' thoughts ...
I wonder if doing the translation from VB to C# with Lutz Roeder's Reflector would be more efficient and accurate than using SharpDevelop ??

[addToListOfThingsToTest]
Do not know what of the demos you guys are using.... I download the first one on the list and opened on visual studio 2005, removed the debug to a2008, did the compile and open it using lutz reflector and getting something like:

Code: [Select]
[CommandMethod("addAnEnt")]
public void AddAnEnt()
{
 ///............
}

All that VB nastiness!


I tried the same Luis ... hardly ' pretty ' sample code, is it  :-)


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.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #34 on: November 16, 2007, 02:02:59 AM »
Just thought I should post the solution as well because of the UserControl.
DevTvIntroCS.zip (52.73 KB - downloaded 2 times.)

Thanks Glenn .. I'll have a look tonight when by head cools down.



....
Just a matter of style, what to you guys think about the comments preceding each code line ?
.. I 'spose it depends on your comfort level with the code ...
« Last Edit: November 16, 2007, 02:05:00 AM by Kerry Brown »
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.

Glenn R

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #35 on: November 16, 2007, 02:59:37 AM »
...er...that's it's a comment...?
What do you mean?

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #36 on: November 16, 2007, 04:19:01 AM »

...er...that's it's a comment...?
What do you mean?

I found the quantity and regularity of comments in the original doc a little overpowering ...
 
In the editor I have turned the color of Comments to silver in the config so they're almost ignorable ..
.. but the comments tend to dominate in code posts and prints.

 I 'spose I'm forgetting that this is/was sample/Example code.

.. just ignore me.
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.

LE

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #37 on: November 16, 2007, 10:59:23 AM »
Just thought I should post the solution as well because of the UserControl.


Thanks, much better!


ps: why that sample was done using vb.net [if he started with c#]? [me like c#]
« Last Edit: November 16, 2007, 11:50:28 AM by LE »

Glenn R

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #38 on: November 16, 2007, 07:59:27 PM »
I've been turning mine to silver for years for the exact same reason...another reason I'm liking CopySourceAsHtml...preserves the colours as you've no doubt seen already.

Cheers,
Glenn.

Glenn R

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #39 on: November 16, 2007, 08:03:22 PM »
As far as comments go, I read something recently which made a lot of sense - don't comment the obvious. An example of this in reference to the code samples we're discussing, would be the comment about getting the editor object...too obvious, therefor I wouldn't do it.

I put in most of the comments (got tired of doing it for the last 2 function/commands as you can see) to preserve what was done in the video for other 'starters' if you will.

I resisted the urge mightilly too I might add to rewrite it - some sections are...'not best practice' shall we say. However, I did change the odd thing here and there, with one of the major ones being I declared the palette and paletteset variables as private and static.

Cheers,
Glenn.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #40 on: November 16, 2007, 08:14:35 PM »

Quote
.... I resisted the urge mightilly too I might add to rewrite it - some sections are...'not best practice' shall we say.


Some of that could be atttributed to the 'Conversion' , some possibly to the writer trying to keep the sample relatively simple.

This is the primary reason why I would have liked to see the sample as "professionally written" C# code 
..... it comes back to a long standing assertion of mine .. most people learn by osmosis ; show them/us enough less than optimal code and that standard  becomes the accepted norm.

Thanks Glenn,
regards, 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.

Glenn R

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #41 on: November 16, 2007, 08:20:10 PM »
Some of that could be atttributed to the 'Conversion'

There was no conversion on my part - I wrote it from scratch. I tend to agree with your comment about the writer keeping it simple...it is afterall an introduction. I also agree that they should lead by example as it were.

Cheers,
Glenn.

David Hall

  • Automatic Duh Generator
  • King Gator
  • Posts: 4075
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #42 on: April 18, 2008, 10:23:47 AM »
I finally got around to watching part of this video.  I didn't download the source code, and now I'm glad I didn't.
Everyone has a photographic memory, Some just don't have film.
They say money can't buy happiness, but it can buy Bacon and that's a close second.
Sometimes the question is more important than the answer. (Thanks Kerry for reminding me)

jjs

  • Guest
Re: DevTV: Introductory recordings on Autodesk APIs
« Reply #43 on: October 06, 2008, 11:50:04 AM »
This topic is old. Thought I might dust it off.