Page 3 of 3 FirstFirst 123
Results 21 to 26 of 26

Thread: How To Find Blocks (Logic)

  1. #21
    Active Member
    Join Date
    2013-06
    Posts
    72
    Login to Give a bone
    0

    Default Re: How To Find Blocks (Logic)

    Quote Originally Posted by BlackBox View Post
    I did the same when migrating from Visual LISP (ActiveX), at first... Got a couple of VB (not VBA) apps working, got really motivated after seeing the performance gains, etc. and then ultimately found it incredibly hard to find 'real' VB code samples of how to do what I was after... I kept finding C# for next to everything instead (which at the time was frustrating).

    I've since been coding in C#, and find it worlds more common-sensical than VB ever was to me - I 'thought' VB would be the most readable, jumping from ActiveX, and to some small extent I was correct in the beginning - the flaw in my logic was approaching .NET as I did Visual LISP, which led to a great deal of confusion. Only when I took a step back, and approached .NET as something entirely new (i.e., away from AutoCAD altogether) did it start to 'register' for me. Stepping into C# in lieu of VB also helped make a clean start with something new.
    I was posed this exact suggestion before (probably by you, actually). It is a pretty good idea, but unless I am losing my mind, it seems like everything for C# basically looks identical to VB, except some syntax. Maybe it's just for simpler stuff.

    With all this programming "learning" I've been doing, I've gotten pretty far behind in actual work. So, back to the grind .

  2. #22
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: How To Find Blocks (Logic)

    Quote Originally Posted by e_casagrande394681 View Post
    I was posed this exact suggestion before (probably by you, actually). It is a pretty good idea, but unless I am losing my mind, it seems like everything for C# basically looks identical to VB, except some syntax. Maybe it's just for simpler stuff.
    Perhaps, and if so, apologies for the redundancy.

    .NET is, well .NET - the family of languages (C#, F#, VB, etc.) each have their own syntax, and even trade-offs which others can certainly clarify better than I... C# has some distinct advantages over that of VB when it comes to Modules, etc. for accessing Extension Methods which recently came up in another thread.



    Quote Originally Posted by e_casagrande394681 View Post
    With all this programming "learning" I've been doing, I've gotten pretty far behind in actual work. So, back to the grind .
    Since New Year, it's been crazy here too.

    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  3. #23
    Active Member
    Join Date
    2013-06
    Posts
    72
    Login to Give a bone
    0

    Default Re: How To Find Blocks (Logic)

    So, I am moving my code over to VB.NET finally, and I am understanding the syntax and making decent progress. I literally have the ENTIRE thing working in VB.NET, as crazy as that seems, EXCEPT the part that I originally didn't know how to do (lol).

    Edit: So, I see what ObjectBrowser does, and how it theoretically helps. However, I am opening the "database" (which I believe to be what "lazy-loads" the .dwg file) using:
    Code:
    Using AcadDbx As New Database(False, True)
    So, I would expect that I would do things like acaddbx.blocktablerecord.getblockreferenceIds() would work, but the "database" loading makes the AcadDbx variable to be of type Autodesk.AutoCAD.DatabaseServices.Database ... blocktablerecord is one step below "database". No instance of BlockTableRecord exists inside the database "tree".

    The only thing that seems to be doable is getting ObjectIDs, but seems I can't do anything with them once I have them.

    I am curious if this "lazy loading" thing is even worth it at all ...
    Last edited by e_casagrande394681; 2015-01-30 at 01:16 AM.

  4. #24
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: How To Find Blocks (Logic)

    Quote Originally Posted by e_casagrande394681 View Post
    So, I am moving my code over to VB.NET finally, and I am understanding the syntax and making decent progress. I literally have the ENTIRE thing working in VB.NET, as crazy as that seems, EXCEPT the part that I originally didn't know how to do (lol).

    Edit: So, I see what ObjectBrowser does, and how it theoretically helps. However, I am opening the "database" (which I believe to be what "lazy-loads" the .dwg file) using:
    Code:
    Using AcadDbx As New Database(False, True)
    So, I would expect that I would do things like acaddbx.blocktablerecord.getblockreferenceIds() would work, but the "database" loading makes the AcadDbx variable to be of type Autodesk.AutoCAD.DatabaseServices.Database ... blocktablerecord is one step below "database". No instance of BlockTableRecord exists inside the database "tree".

    The only thing that seems to be doable is getting ObjectIDs, but seems I can't do anything with them once I have them.

    I am curious if this "lazy loading" thing is even worth it at all ...
    ObjectIds (aka Entity Names, or enames) are exactly what you're after, and need to be opened via Transaction, for Read or Write as needed. Much faster to open for Read until the appropriate Type is identified, then UpgradeOpen(), <do something useful>, DowngradeOpen()... Just be sure to Commit() when done.... So long as your Transaction is within a using block, the necessary garbage collection and DBObject.Close() calls will be handled for you.
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

  5. #25
    Woo! Hoo! my 1st post
    Join Date
    2015-12
    Posts
    1
    Login to Give a bone
    0

    Default Re: How To Find Blocks (Logic)

    This is actually a fairly trivial problem in AutoLISP. Check out an article I wrote at



    I can scan about 10,000 drawings in under an hour and spit out a comma-delimited file that can be opened in Excel that lists pretty much anything you want to find, such as file path, file name, all block definition names, specific block definition names, block insertions, and attribute values. I can also find and list things like every drawing that contains a specific object with particular properties, such as a circle of a specified diameter that lives on a specific layer and so on. Let me know if you need more help.

  6. #26
    Administrator BlackBox's Avatar
    Join Date
    2009-11
    Posts
    5,714
    Login to Give a bone
    0

    Default Re: How To Find Blocks (Logic)

    Quote Originally Posted by bill_fane View Post
    This is actually a fairly trivial problem in AutoLISP. Check out an article I wrote at

    http://www.cadalyst.com/cad/autocad/...entities-15152

    I can scan about 10,000 drawings in under an hour and spit out a comma-delimited file that can be opened in Excel that lists pretty much anything you want to find, such as file path, file name, all block definition names, specific block definition names, block insertions, and attribute values. I can also find and list things like every drawing that contains a specific object with particular properties, such as a circle of a specified diameter that lives on a specific layer and so on. Let me know if you need more help.
    Welcome to AUGI.

    This is a fairly trivial problem for any API, but this does happen to be the .NET forum and not the AutoLISP forum... You know, if you're after a specific audience to read your Cadalyst article, methinks.

    LISP is my first programming language, and I use it often for quick routines in my work on civil design projects, but I'd be remiss to not point out the measurable performance gains of using .NET (as a generalization)... You might consider Fenton's excellent The Right Tools For The Job DevBlog articles (3 part series)... Spoilers:





    Cheers
    "How we think determines what we do, and what we do determines what we get."

    Sincpac C3D ~ Autodesk Exchange Apps

    Computer Specs:
    Dell Precision 3660, Core i9-12900K 5.2GHz, 64GB DDR5 RAM, PCIe 4.0 M.2 SSD (RAID 0), 16GB NVIDIA RTX A4000

Page 3 of 3 FirstFirst 123

Similar Threads

  1. Anyone know where I can find Blocks of dental chairs?
    By dwe61 in forum AutoCAD General
    Replies: 7
    Last Post: 2012-09-27, 10:18 AM
  2. Where can I find free CAD blocks?
    By gbelous in forum AutoCAD General
    Replies: 4
    Last Post: 2010-01-28, 05:54 PM
  3. Find Replace Text in Blocks
    By shadow_kris in forum AutoLISP
    Replies: 3
    Last Post: 2008-01-29, 08:20 PM
  4. Can't find Dynamic Blocks
    By Darren Allen in forum Dynamic Blocks - Technical
    Replies: 4
    Last Post: 2007-12-05, 03:01 PM
  5. How to find the exploded blocks
    By vkotesh in forum AutoLISP
    Replies: 5
    Last Post: 2006-01-06, 02:35 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •