Author Topic: AutoCAD DevBlog  (Read 19852 times)

0 Members and 1 Guest are viewing this topic.

SGP2012

  • Guest
AutoCAD DevBlog
« on: April 18, 2012, 05:52:37 PM »
Thought some of you might like to bookmark this - http://adndevblog.typepad.com/autocad.

Cheers,

Stephen Preston
Autoesk Developer Network


Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoCAD DevBlog
« Reply #1 on: April 18, 2012, 06:14:25 PM »
Thanks Stephen,
Looks like there is some good info there already :)

I like the idea of multiple contributers.

This will become a regular read I think, particularly while Kean has his head in the 'Cloud'.



Regards
Kerry

PS Perhaps the recent discussion here regarding using statements and disposing could be translated as a definitive reference for the general population ...
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: AutoCAD DevBlog
« Reply #2 on: April 18, 2012, 06:20:07 PM »


Did Some of the topics originate as ADN KnowledgeBase topics. ... they all seem to relate to specific issues that have not been previously publically documented ... and that's good in my book :)

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.

dgorsman

  • Water Moccasin
  • Posts: 2437
Re: AutoCAD DevBlog
« Reply #3 on: April 18, 2012, 06:22:57 PM »
Oopsie - shouldn't that be "acaddoc.lsp" not "acadXXXXdoc.lsp"?  The latter contains AutoDesk-created stuff, and even they recommend using the former.
If you are going to fly by the seat of your pants, expect friction burns.

try {GreatPower;}
   catch (notResponsible)
      {NextTime(PlanAhead);}
   finally
      {MasterBasics;}

SGP2012

  • Guest
Re: AutoCAD DevBlog
« Reply #4 on: April 18, 2012, 06:25:40 PM »
Hi Kerry,

Over time, we will move all of the ADN knowledgebase to the blog. However, that's several thousand articles that we have to migrate to support our 2013 products at the same time - so that will be a slow process :-).

Cheers,

Stephen

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoCAD DevBlog
« Reply #5 on: April 18, 2012, 06:39:49 PM »
Hi Kerry,

Over time, we will move all of the ADN knowledgebase to the blog. However, that's several thousand articles that we have to migrate to support our 2013 products at the same time - so that will be a slow process :-).

Cheers,

Stephen

Yes, I just read the Welcome post from February ... typical that I do things arse backwards :-D
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.

mohnston

  • Bull Frog
  • Posts: 305
  • CAD Programmer
Re: AutoCAD DevBlog
« Reply #6 on: April 18, 2012, 07:23:38 PM »
Hi Kerry,

Over time, we will move all of the ADN knowledgebase to the blog. However, that's several thousand articles that we have to migrate to support our 2013 products at the same time - so that will be a slow process :-).

Cheers,

Stephen

Maybe someone could write a program to automate the process. :wink:

I have bookmarked the new blog and wanted to offer my sincere thanks for undertaking such a valuable project.
I will be a regular reader.
It's amazing what you can do when you don't know what you can't do.
CAD Programming Solutions

Jeff H

  • Needs a day job
  • Posts: 6150
Re: AutoCAD DevBlog
« Reply #7 on: April 18, 2012, 07:35:07 PM »
Hi Kerry,

Over time, we will move all of the ADN knowledgebase to the blog. However, that's several thousand articles that we have to migrate to support our 2013 products at the same time - so that will be a slow process :)

Cheers,

Stephen
Awesome!!!
Thanks for the news.
 
So i guess this means ADN members will be getting a partial refund.  :D
Sweet!
 
 
 

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoCAD DevBlog
« Reply #8 on: April 18, 2012, 07:51:54 PM »
< .. >
Awesome!!!
Thanks for the news.
 
So i guess this means ADN members will be getting a partial refund.  :D
Sweet!

Yes, it is awesome ..

and no .. It means we can start asking harder questions 'cause most of the tough ones will be already answered
ie :  concentrate on skinning the cat instead of sharpening the knife.
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.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: AutoCAD DevBlog
« Reply #9 on: April 19, 2012, 01:34:40 AM »
Very interesting, thanks.
Speaking English as a French Frog

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoCAD DevBlog
« Reply #10 on: April 19, 2012, 05:44:00 AM »

Stephen,
Is there any way the code pane width can be made wider to allow the code a better chance of being readable (due to the narrow space provided on the blog).

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.

TheMaster

  • Guest
Re: AutoCAD DevBlog
« Reply #11 on: April 19, 2012, 03:50:02 PM »
Thought some of you might like to bookmark this - http://adndevblog.typepad.com/autocad.

Cheers,

Stephen Preston
Autoesk Developer Network

You might want to consider having someone capable of doing it,
review the posted content.

There's a serious error in the contextual ribbon tab example.
The sample code repeatedly adds handlers to the Application.Idle
event, and never removes them.

See the other thread I started for a helper API for dealing with
the Idle event.

TJK44

  • Guest
Re: AutoCAD DevBlog
« Reply #12 on: April 20, 2012, 09:39:41 AM »
Pretty cool... I just noticed the logo for the DevBlog was provided by my company.

TheMaster

  • Guest
Re: AutoCAD DevBlog
« Reply #13 on: April 20, 2012, 10:06:20 AM »
Thought some of you might like to bookmark this - http://adndevblog.typepad.com/autocad.

Cheers,

Stephen Preston
Autoesk Developer Network

Aside from my long-time loathing of TypePad as a blogging platform
for topics dealing with technical content and code, I think your readers
could really do without the line numbers in code, which prevents them
from copying/pasting it into an IDE.

LE3

  • Guest
Re: AutoCAD DevBlog
« Reply #14 on: April 20, 2012, 10:36:52 AM »
Good to have another resource... can be there a link to also promote TheSwamp.org ?

kaefer

  • Guest
Re: AutoCAD DevBlog
« Reply #15 on: April 20, 2012, 10:39:47 AM »
I think your readers
could really do without the line numbers in code, which prevents them
from copying/pasting it into an IDE.

That charge could be leveled at this forum too, and it's a minor inconvenience at that (think ALT-SHIFT-Arrow). On the other hand, a reference to a line number can be handy in case someone is actually commenting on a piece of code.

LE3

  • Guest
Re: AutoCAD DevBlog
« Reply #16 on: April 20, 2012, 10:51:37 AM »
some 2cts...

- Navigation is not easy - every time i click on the code area or anywhere it goes to the top of the page.
- Can you guys provide a file download too?
- Or add a 'Select code' or something similar, to be able to grab it?

TheMaster

  • Guest
Re: AutoCAD DevBlog
« Reply #17 on: April 20, 2012, 02:47:48 PM »
I think your readers
could really do without the line numbers in code, which prevents them
from copying/pasting it into an IDE.

That charge could be leveled at this forum too, and it's a minor inconvenience at that (think ALT-SHIFT-Arrow). On the other hand, a reference to a line number can be handy in case someone is actually commenting on a piece of code.

Nope, here when I right click on code with line numbers (code=csharp)
and Copy, there's no line numbers when I paste it as plain text.

I can't remember the last time I saw annotation referring to line numbers
in code here.  So, WRT the AutoCAD DevBlog, it's a bit silly to inconvenience
readers with line numbers that are copied and pasted, when they serve no
purpose (I don't recall seeing any references to line numbers in the articles
I read there).

Line numbers in code isn't a problem on this site, since they aren''t copied
with the code.

« Last Edit: April 20, 2012, 06:22:25 PM by TheMaster »

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: AutoCAD DevBlog
« Reply #18 on: April 20, 2012, 02:55:26 PM »
That charge could be leveled at this forum too, and it's a minor inconvenience at that (think ALT-SHIFT-Arrow). On the other hand, a reference to a line number can be handy in case someone is actually commenting on a piece of code.

FYI, you can forgo line numbers and colour formatting by omitting the language tag from the bbcode code tags, i.e.:

[code]
(defun c:helloworld ( )
    (princ "\nHello World!")
)
[/code]

Will produce:

Code: [Select]
(defun c:helloworld ( )
    (princ "\nHello World!")
)

( Just in case you weren't aware )

TheMaster

  • Guest
Re: AutoCAD DevBlog
« Reply #19 on: April 20, 2012, 06:24:16 PM »
That charge could be leveled at this forum too, and it's a minor inconvenience at that (think ALT-SHIFT-Arrow). On the other hand, a reference to a line number can be handy in case someone is actually commenting on a piece of code.

FYI, you can forgo line numbers and colour formatting by omitting the language tag from the bbcode code tags, i.e.:

[code]
(defun c:helloworld ( )
    (princ "\nHello World!")
)
[/code]

Will produce:

Code: [Select]
(defun c:helloworld ( )
    (princ "\nHello World!")
)

( Just in case you weren't aware )

My comments were regarding the AutoCAD DevBlog, since there is
no way to copy the code without getting the line numbers.

As I mentioned in my revised comment, the line numbers aren't
a problem on this site, since they don't get copied (or at least,
not with Chrome).

And, after giving it more thought, I think code line numbers are
not all that useful because you don't know what line you are
referring to in annotations until after you posted the code, and
even worse, if you revise the posted code and insert/delete
lines, references to line numbers are no longer valid.   

So what good are they?

« Last Edit: April 20, 2012, 06:28:58 PM by TheMaster »

Lee Mac

  • Seagull
  • Posts: 12913
  • London, England
Re: AutoCAD DevBlog
« Reply #20 on: April 20, 2012, 06:53:12 PM »
That charge could be leveled at this forum too, and it's a minor inconvenience at that (think ALT-SHIFT-Arrow). On the other hand, a reference to a line number can be handy in case someone is actually commenting on a piece of code.

FYI, you can forgo line numbers and colour formatting by omitting the language tag from the bbcode code tags, i.e.:

[code]
(defun c:helloworld ( )
    (princ "\nHello World!")
)
[/code]

Will produce:

Code: [Select]
(defun c:helloworld ( )
    (princ "\nHello World!")
)

( Just in case you weren't aware )

My comments were regarding the AutoCAD DevBlog, since there is
no way to copy the code without getting the line numbers.

I know, I was replying to kaefer - hence why I quoted his post.

SGP2012

  • Guest
Re: AutoCAD DevBlog
« Reply #21 on: April 24, 2012, 10:24:23 PM »
I didn't expect to pop back to TheSwamp and find this thread had morphed into a discussion about line numbering.   :lol:

I agree that the line numbers are an inconvenience if they're not being used to refer to the code from the supporting text. We're still working out the best formats to use right now, but I plan to ask the DevBlog team not to use line numbering when copying code from VS (unless someone persuades me they're important in the meantime).

@LE - Of course we link to TheSwamp from DevBlog - See the 'Useful links' page.  :laugh:

Cheers,

Stephen

Arizona

  • Guest
Re: AutoCAD DevBlog
« Reply #22 on: April 25, 2012, 05:59:03 AM »
Thanks Stephen!
I'm sure I will be a frequent visitor :-)

twdotson

  • Mosquito
  • Posts: 17
Re: AutoCAD DevBlog
« Reply #23 on: April 25, 2012, 11:50:52 AM »
How about a link to a .CS or .VB text file on each topic so it doesn't matter if it has line numbers or line breaks where code shouldn't break or anything for that matter.

All copy problems solved !!!

vegbruiser

  • Guest
Re: AutoCAD DevBlog
« Reply #24 on: April 27, 2012, 11:41:40 AM »
Here's "An aggregated feed of the various development-related blogs published by Autodesk.":

http://pipes.yahoo.com/pipes/pipe.run?_id=_pwmy5T93RGCMUcmrbQIDg&_render=rss

Thanks to KeanW for updating/including the new DevBlog in the feed.

Jeff H

  • Needs a day job
  • Posts: 6150
Re: AutoCAD DevBlog
« Reply #25 on: May 03, 2012, 02:58:15 PM »
When I read this at Through the Interface I remember thinking who was Kean replacement going to be.
 
I have not seen a official announcement but it looks like Stephen Preston is now in charge.
 
Reading some of Stephen's recent post at different at forums and  for example the DevBlog(I have no idea how much Stephen did or did not have to do with it being launched) but seems he is doing what he can to make AutoCAD development a better experience.
 
Just wanted to let him know it is not going unnoticed and is appreciated.
 
Thanks and congrads on promotion Stephen
 
 
 
 

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoCAD DevBlog
« Reply #26 on: May 04, 2012, 04:42:10 AM »


I was asked a question today I couldn't answer.

'Why didn't  they do this 5 years ago ??'
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.

MexicanCustard

  • Swamp Rat
  • Posts: 705
Re: AutoCAD DevBlog
« Reply #27 on: May 04, 2012, 10:25:50 AM »


I was asked a question today I couldn't answer.

'Why didn't  they do this 5 years ago ??'

They did, it was called ADN. Which until now was the good ol' boys club.  Now they seem to be opening up to those of us not in ADN.

Why don't they post examples for the vertical products (other than C3D) now?
Revit 2019, AMEP 2019 64bit Win 10

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoCAD DevBlog
« Reply #28 on: May 17, 2012, 06:16:29 PM »

For anyone who isn't already visiting the blog regularly ..... it's becoming a good resource and well worth a regular visit.  (or subscribing to a feed :) )
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.

TheMaster

  • Guest
Re: AutoCAD DevBlog
« Reply #29 on: May 17, 2012, 08:24:48 PM »


I was asked a question today I couldn't answer.

'Why didn't  they do this 5 years ago ??'

They did, it was called ADN. Which until now was the good ol' boys club.  Now they seem to be opening up to those of us not in ADN.

Why don't they post examples for the vertical products (other than C3D) now?

It wasn't really a good ole boys club, it was an attempt to monetize development documentation, code samples, etc. 

While providing support and software for development purposes isn't something we expect for free, charging customers and developers for code samples and all the missing pieces and corrections to errors in the published docs (which are among the worst in the industry) is underhanded, at best.

« Last Edit: May 17, 2012, 08:42:39 PM by TheMaster »

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoCAD DevBlog
« Reply #30 on: June 13, 2012, 07:27:47 PM »

For anyone who isn't already visiting the blog regularly ..... it's becoming a good resource and well worth a regular visit.  (or subscribing to a feed :) )

Except for the horrid orange colour.
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.

BlackBox

  • King Gator
  • Posts: 3770
Re: AutoCAD DevBlog
« Reply #31 on: July 13, 2012, 10:14:00 AM »
As I learn more and more about development in .NET, I am repeatedly reminded why I love coding in LISP:

Quote from: AdnDevBlog, 2012-07-13, Getting field code from field object

Getting field code from field object

Below code shows the procedure to get the field code from text object. Code first checks whether field object is associated with text object or not using API “HasFields”. Then, uses “GetField” API of Mtext object to get the field object and shows the field code using API “GetFieldCode”.

Code - C#: [Select]
  1.  
  2.  
  3.  
  4. [CommandMethod("GetFieldcode")]
  5.  
  6. public void GetFieldcode()
  7.  
  8. {
  9.  
  10.     Document doc = Application.DocumentManager.MdiActiveDocument;
  11.  
  12.     Database db = doc.Database;
  13.  
  14.     Editor ed = doc.Editor;
  15.  
  16.  
  17.     PromptEntityOptions options =
  18.  
  19.             new PromptEntityOptions("\nSelect a Mtext object");
  20.  
  21.     options.SetRejectMessage("\nSelect Mtext object");
  22.  
  23.     options.AddAllowedClass(typeof(MText), false);
  24.  
  25.  
  26.     PromptEntityResult acSSPrompt = ed.GetEntity(options);
  27.  
  28.  
  29.     if (acSSPrompt.Status != PromptStatus.OK)
  30.  
  31.         return;
  32.  
  33.  
  34.     using (Transaction Tx = db.TransactionManager.StartTransaction())
  35.  
  36.     {
  37.  
  38.         //get the mleader
  39.  
  40.         MText mtext = Tx.GetObject(acSSPrompt.ObjectId,
  41.  
  42.                                    OpenMode.ForRead) as MText;
  43.  
  44.  
  45.         if (!mtext.HasFields)
  46.  
  47.         {
  48.  
  49.             ed.WriteMessage("\nObject does not contain fields.");
  50.  
  51.             return;
  52.  
  53.         }
  54.  
  55.  
  56.         ObjectId id = mtext.GetField("TEXT");
  57.  
  58.         Field field = Tx.GetObject(id, OpenMode.ForRead) as Field;
  59.  
  60.  
  61.         string fldCode = field.GetFieldCode(FieldCodeFlags.AddMarkers
  62.  
  63.                                          | FieldCodeFlags.FieldCode);
  64.  
  65.         ed.WriteMessage("\nField code: " + fldCode);
  66.  
  67.         Tx.Commit();
  68.  
  69.     }
  70.  
  71. }
  72.  
  73.  


... Pseudo LISP equivalent:
 
Code - Auto/Visual Lisp: [Select]
  1. (defun c:GetFieldCode (/ ss fieldCode)
  2.   (princ "\rSelect text entity to get field code: ")
  3.   (if (setq ss (ssget ":S:E" '((0 . "MTEXT,TEXT"))))
  4.     (prompt
  5.       (cond
  6.         ((wcmatch
  7.            (setq fieldCode
  8.                   (vla-fieldcode
  9.                     (vlax-ename->vla-object (ssname ss 0))))
  10.            "%*")
  11.          (strcat "\nField code: " fieldCode))
  12.         ("\n** No field code found ** "))))
  13.   (princ))
  14.  
"How we think determines what we do, and what we do determines what we get."

zoltan

  • Guest
Re: AutoCAD DevBlog
« Reply #32 on: July 13, 2012, 12:08:22 PM »
As I learn more and more about development in .NET, I am repeatedly reminded why I love coding in LISP:
...

I used to feel that way when realizing how much more code it takes to get anything done in .NET vs. Lisp, but then I came to learn how much more you can do in .NET and how elegant you can make things... and also that DCL is garbage for making a descent UI!

BlackBox

  • King Gator
  • Posts: 3770
Re: AutoCAD DevBlog
« Reply #33 on: July 13, 2012, 12:24:18 PM »
As I learn more and more about development in .NET, I am repeatedly reminded why I love coding in LISP:
...

I used to feel that way when realizing how much more code it takes to get anything done in .NET vs. Lisp,

Please don't mistake my meaning... I am still dedicated to all of my extra-curricular .NET development initiatives.  :kewl:

I only meant for, what I am considering to be a remedial task such as this, LISP to this day is superior with regard to the brevity of code required.

but then I came to learn how much more you can do in .NET and how elegant you can make things... and also that DCL is garbage for making a descent UI!

Obviously, the point is moot, were one to be developing a truly .NET worthy application (something which I have only contributed to in a small way (so far) ;-) ), from which this was one small Method (out of tens, hundreds, or even thousands given any Solution?).


... I simply appreciate more now, where I've come from, as I continue to move forward.
"How we think determines what we do, and what we do determines what we get."

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: AutoCAD DevBlog
« Reply #34 on: July 13, 2012, 01:24:12 PM »
I thaught the same when I began with .NET.
Now I'm a little more comfortable with .NET I like it more and more even I still do like LISP too.

If you're interest with concision and elegancy, using Linq and home made extension methods allows a more declarative/functional style (search for GetObjects<T> in this forum for instance).
Or jump to F#.
Speaking English as a French Frog

TheMaster

  • Guest
Re: AutoCAD DevBlog
« Reply #35 on: July 13, 2012, 03:31:43 PM »
.... (search for GetObjects<T> in this forum for instance)....

Hmmmm.

I just did that. Searching for GetObjects<T> produces no results.

Searching for 'GetObjects' (without the "<T>"), returns only your post containing the above quote. :s

Keith™

  • Villiage Idiot
  • Seagull
  • Posts: 16899
  • Superior Stupidity at its best
Re: AutoCAD DevBlog
« Reply #36 on: July 13, 2012, 04:47:18 PM »
.... (search for GetObjects<T> in this forum for instance)....

Hmmmm.

I just did that. Searching for GetObjects<T> produces no results.

Searching for 'GetObjects' (without the "<T>"), returns only your post containing the above quote. :s

There are two things at work here ... first the forum software apparently doesn't work with come characters or it treats them as some kind of code i.e. GetObjects<T> will not return anything. Removing the <T> will produce results ... which brings me to the second item. Searching from within any board or child-board only returns hits from those boards and its children. To search the entire swamp forum, you have to search from the main page.

Searching from the main page using GetObjects returns about 20 hits.
Proud provider of opinion and arrogance since November 22, 2003 at 09:35:31 am
CadJockey Militia Field Marshal

Find me on https://parler.com @kblackie

TheMaster

  • Guest
Re: AutoCAD DevBlog
« Reply #37 on: July 13, 2012, 05:26:43 PM »

Searching from within any board or child-board only returns hits from those boards and its children. To search the entire swamp forum, you have to search from the main page.

Searching from the main page using GetObjects returns about 20 hits.

Thanks.

The second attempt was made at the result page for the first attempt, so I would have expected it to have the same scope, but guess not.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: AutoCAD DevBlog
« Reply #38 on: July 13, 2012, 08:39:39 PM »
.NET isn't necessary as verbose as shown in AutoCAD DevBlog...

Quote
There is no .NET API for it, but a COM API that can be used from .NET with AcSelect mode as acSelectionSetCrossingPolygon. The following sample function demonstrate it, and after an example of how use it. This code uses Late Binding, so you can use on your .NET code without need to reference Interop assemblies.
Code - vb.net: [Select]
  1. Public Shared Function selectCrossing(ByVal pline As Polyline, _
  2.                                 ByVal entitiesNames As String) _
  3.                                 As ObjectIdCollection
  4.   'This method was designed using COM/ActiveX API, but all types
  5.   'were replaced with Object, which means we're using Late Binding.
  6.   'Therefore no Interop references are needed
  7.  
  8.   'AcadApplication
  9.   Dim acadApp As Object = Application.AcadApplication
  10.   'AcadDocument
  11.   Dim acadDoc As Object = acadApp.ActiveDocument
  12.  
  13.   Dim ssetObj As Object
  14.   Dim pointsArray(0) As Double
  15.   Dim grpCode(0) As Integer
  16.   Dim grpValue(0) As Object
  17.   Dim mode As Integer
  18.  
  19.   'this selection only works with entities visible on the screen,
  20.   'so we need to extend to make sure everything is visible
  21.   'acadApp.ZoomExtends()
  22.   'acadApp.Update()
  23.  
  24.   ReDim pointsArray(pline.NumberOfVertices * 3 - 1)
  25.   For i As Integer = 0 To pline.NumberOfVertices - 1
  26.     Dim vertice As Point3d = pline.GetPoint3dAt(i)
  27.     pointsArray(i * 3 + 0) = vertice.X
  28.     pointsArray(i * 3 + 1) = vertice.Y
  29.     pointsArray(i * 3 + 2) = vertice.Z
  30.   Next
  31.  
  32.   'will store the entities inside the region
  33.   Dim objIdColl As New ObjectIdCollection
  34.  
  35.   ssetObj = acadDoc.SelectionSets.Add("TEMPSELSET1")
  36.   ssetObj.Clear()
  37.  
  38.   Dim gpCode As Int16()
  39.   ReDim gpCode(1)
  40.   gpCode(0) = 0
  41.   gpCode(1) = 10
  42.  
  43.   Dim dataValue As Object()
  44.   ReDim dataValue(0)
  45.   dataValue(0) = entitiesNames
  46.  
  47.   Dim groupCode As Object, dataCode As Object
  48.   groupCode = gpCode
  49.   dataCode = dataValue
  50.  
  51.   'these modes are definied under
  52.   'Autodesk.AutoCAD.Interop.Common.AcSelect
  53.   'but again we're not using explicit Interop references
  54.   mode = 7 'AcSelect.acSelectionSetCrossingPolygon
  55.   ssetObj.SelectByPolygon(mode, pointsArray, groupCode, dataCode)
  56.  
  57.   ' if one or more point entities in the selection area
  58.   If ssetObj.count >= 1 Then
  59.     For Each ent In ssetObj
  60.       objIdColl.Add(New ObjectId(New IntPtr(CLng(ent.ObjectID))))
  61.     Next ent
  62.   End If
  63.  
  64.   ssetObj.Delete() 'delete the temp selection set
  65.  
  66.   'acadApp.ZoomPrevious() 'restore the zoom
  67.  
  68.   Return objIdColl
  69. End Function

F# equivalent (using the .NET API which does exist)
Code - F#: [Select]
  1. let selectCrossing (pline: Polyline) (entityNames: string) =
  2.     let ed = Application.DocumentManager.MdiActiveDocument.Editor
  3.     let pointsArray = [| for i in 0 .. pline.NumberOfVertices - 1 -> pline.GetPoint3dAt(i) |]
  4.     use view = ed.GetCurrentView()
  5.     zoomExtents()
  6.     let psr = ed.SelectCrossingPolygon(
  7.                 new Point3dCollection(pointsArray),
  8.                 new SelectionFilter([| new TypedValue(0, entityNames) |]))
  9.     ed.SetCurrentView(view)
  10.     match psr.Status with
  11.     | PromptStatus.OK -> new ObjectIdCollection(psr.Value.GetObjectIds())
  12.     | _ -> new ObjectIdCollection()
Speaking English as a French Frog

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoCAD DevBlog
« Reply #39 on: July 13, 2012, 09:16:23 PM »
Hmmm ..

I wonder why he used COM instead of .NET for the solution ??



and ...

'acadApp.ZoomExtends()
should be
'acadApp.ZoomExtents()
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.

n.yuan

  • Bull Frog
  • Posts: 348
Re: AutoCAD DevBlog
« Reply #40 on: July 15, 2012, 02:43:38 PM »
He (the author of the DevBlog) did not just "used COM instead of .NET for the solution", he actually claimed that "There is no .NET API for it".

That makes me wondering if he had ever done ACAD .NET API programming at the time when he wrote it. Well, he probably just post something he wrote long time ago. But, come on, if you post something, shouldn't you at least know what it is talk about. Such a obviously false claim from Autodesk side is laughstock.

I commented on that post and my comment did not live there for a few hours and gone. Someone removed my comment, and unfortunately, he forgot one thing: also removing the post altogether, which may give bad direction for someone who is new to Acad .NET API and trust the information posted in AutoCAD DevBlog.

gile

  • Gator
  • Posts: 2507
  • Marseille, France
Re: AutoCAD DevBlog
« Reply #41 on: July 15, 2012, 04:08:06 PM »
My comment hasn't been censored.
Maybe they (Autodesk guys) didn't see it was ironical  :evil:
Speaking English as a French Frog

Jeff H

  • Needs a day job
  • Posts: 6150
Re: AutoCAD DevBlog
« Reply #42 on: July 16, 2012, 10:20:41 AM »
Someone removed my comment, and unfortunately, he forgot one thing: also removing the post altogether
Now it looks like he remembered
 
My comment hasn't been censored.
Maybe they (Autodesk guys) didn't see it was ironical  >:D
Now it has.
The link in your post is broken and not seeing post on DevLab

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: AutoCAD DevBlog
« Reply #43 on: July 17, 2012, 01:20:34 AM »
The Right Tools for the Job – AutoCAD Part 1
http://adndevblog.typepad.com/autocad/2012/07/the-right-tools-for-the-job-autocad-part-1.html

Quote from: by Fenton Webb
Recently, Stephen posted this great blog entry on Performance – perception versus reality and then asked me if I could tell you all the tricks I have learnt over the years to produce the fastest, leanest AutoCAD code on the planet !!
   

looking forward to this :)

added:

... just hope the intro isn't making use of poetic licence. :D

 
« Last Edit: July 17, 2012, 01:26:28 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.