Recent Posts

Pages: [1] 2 3 ... 10
1
.NET / Previews or Thumbnails
« Last post by cmwade77 on Today at 02:40:45 PM »
I am trying to extract a preview or thumbnail from drawings without opening them, I have code that does well if the thumbnail is saved (i.e. it shows up in Windows Explorer), but if it isn't saved, it doesn't show up.

Yet, it sheet set manager, a preview can be shown just fine for the same drawing, so there has to be something that I am missing here. Here is my code as it stands:
Code - C#: [Select]
  1.  public static Bitmap? Thumbnail(this string drawingFilePath)
  2.  {
  3.      try
  4.      {
  5.          using (Database db = new Database(false, true))
  6.          {
  7.              db.ReadDwgFile(drawingFilePath, FileOpenMode.OpenForReadAndAllShare, true, null);
  8.              Bitmap? thumbnail = db.ThumbnailBitmap;
  9.              if (thumbnail == null)
  10.              {
  11.                  return PlaceholderThumbnail();
  12.              }
  13.              return thumbnail;
  14.          }
  15.      }
  16.      catch (System.Exception ex)
  17.      {
  18.          Application.DocumentManager.MdiActiveDocument.Editor.WriteMessage($"\nError extracting thumbnail: {ex.Message}");
  19.          return null;
  20.      }
  21.  }

Any ideas would be greatly appreciated.
2
.NET / What’s new in C# 13
« Last post by It's Alive! on Today at 04:07:48 AM »
3
AutoLISP (Vanilla / Visual) / Re: Lisp to count text in drawing
« Last post by HOSNEYALAA on Today at 12:37:13 AM »
Can you attached example drawing

try replace

;;(setq s (ssget "_X" '((0 . "TEXT,MTEXT"))))


(setq s (ssget "_X" '((0 . "TEXT,MTEXT")(1 . "*GL1A*"))))
4
.NET / Re: AutoCAD2025 and loading dependency dll's
« Last post by MickD on May 29, 2024, 10:59:47 PM »
I only have one .NET module left that I maintain in the app store. The framework version actually loaded just fine in 2025,
but I went ahead and used the conversion tool and ported it to Core.
:-o
Looks like I need to create another project just for this build...

I never tried to step into to it with the debugger though. I remember that .NET would load specific debugger depending on the .config settings.. so it may run, just not debug
I’m going to rewrite it in C++, I didn’t take the news of Microsoft depreciating framework well   :crazy2:

:)
5
.NET / Re: AutoCAD2025 and loading dependency dll's
« Last post by It's Alive! on May 29, 2024, 10:37:31 PM »
I only have one .NET module left that I maintain in the app store. The framework version actually loaded just fine in 2025,
but I went ahead and used the conversion tool and ported it to Core.

I never tried to step into to it with the debugger though. I remember that .NET would load specific debugger depending on the .config settings.. so it may run, just not debug
I’m going to rewrite it in C++, I didn’t take the news of Microsoft depreciating framework well   :crazy2:

6
.NET / Re: AutoCAD2025 and loading dependency dll's
« Last post by MickD on May 29, 2024, 10:13:21 PM »
Maybe that’s a Framework DLL that doesn’t like Core?

huh, thanks for the heads up, I checked the install req's and:
Quote
If it’s not already installed, Microsoft .NET Framework 4.8, will also be installed with AutoCAD 2025 including Specialized Toolsets. Microsoft .NET Framework 4.8 also requires a Windows version that’s currently supported by Microsoft.

Then did a search for AutoCAD dependencies and found: ( https://help.autodesk.com/view/OARX/2025/ENU/?guid=GUID-450FD531-B6F6-4BAE-9A8C-8230AAC48CB4 )
Quote
If you are targeting AutoCAD 2025 or AutoCAD 2025-based programs, you should use:

Microsoft Visual Studio 2022 version 17.8.0
Microsoft .NET 8.0

Ok, but then:
Quote
Note: Applications compiled with Microsoft Visual Studio 2019 version 16.0 or later should load into AutoCAD 2025 or AutoCAD 2025-based programs without any problems.

Anyway, thanks again for the nudge, I'll try it with .Net 8 and see how that goes, cheers.
7
.NET / Re: AutoCAD2025 and loading dependency dll's
« Last post by It's Alive! on May 29, 2024, 09:51:51 PM »
Maybe that’s a Framework DLL that doesn’t like Core?

 
8
.NET / AutoCAD2025 and loading dependency dll's
« Last post by MickD on May 29, 2024, 09:19:50 PM »
A user alerted me to a problem loading my application in AutoCAD 2025, after installing AutoCAD 2025 and running the debugger I'm getting the same error and digging deeper in inner exceptions I get:

Code: [Select]
"Unable to load DLL 'mscorwks.dll' or one of its dependencies: The specified module could not be found. (0x8007007E)"
This has been working fine and works in the latest BricsCAD without issue. The dll referenced in is a supporting .net dll for my plugin and is used for both BricsCAD and AutoCAD builds and is independent of either platform (i.e. no ref's to CAD).

I've tried setting trusted folders and downrating security, running acad as admin etc, are there any other new security features in AutoCAD 2025 I might be missing? The dll definitely exists on my machine and AutoCAD loads the .Net framework if it's not installed so I have no clue why it can't find/load it.

Has anyone else had trouble loading dependencies of your plugin's dlls with the new AutoCAD?

UPDATE:
copying the dll into my plugin's folder works, this is not right though IMO, and why has this problem just started now??

9
AutoLISP (Vanilla / Visual) / Lisp to count text in drawing
« Last post by Mjf1999 on May 29, 2024, 09:15:52 AM »
Hello

I saw the below lisp by Tharwat Al Choufi, it works very well, but it counts all the texts, can it be modified to find/search for a specific text or part of a text (i.e. GL1A or GL1A*)

The link for the lisp is
https://www.theswamp.org/index.php?topic=57209.msg607461#msg607461


Thank you



(defun c:Test (/ s i e l g p b c r)
  ;; Tharwat Al Choufi - Date : 13.Dec.2021     ;;
  (and (setq s (ssget "_X" '((0 . "TEXT,MTEXT"))))
       (repeat (setq i (sslength s))
         (setq i (1- i)
               e (entget (ssname s i))
               l (list (cdr (assoc 1 e)) (cdr (assoc 8 e)))
         )
         (or (and (vl-some (function (lambda (q)
                                       (and (= (car q) (car l))
                                            (= (cadr q) (cadr l))
                                            (setq r q)
                                       )
                                     )
                           )
                           g
                  )
                  (setq g (vl-remove r g)
                        g (cons (append l (list (1+ (caddr r)))) g)
                  )
             )
             (setq g (cons (append l (list 1)) g))
         )
       )
       (setq p (getpoint "\nTable insertion point :"))
       (setq r 1
             b (vla-addtable
                 (vla-get-block
                   (vla-get-activelayout
                     (vla-get-activedocument (vlax-get-acad-object))
                   )
                 )
                 (vlax-3d-point p)
                 (+ 2 (length g))
                 3
                 635
                 3100
               )
       )
       (progn
         (vla-put-RegenerateTableSuppressed b :vlax-true)
         (vla-setcolumnwidth b 2 1300)
         (mapcar '(lambda (r_ c_ s_)
                    (set:text_ b r_ c_ 350 s_)
                  )
                 '(0 1 1 1)
                 '(0 0 1 2)
                 '("STRING COUNT" "String" "Layer" "QTY")
         )
         (foreach s (vl-sort g '(lambda (j k) (< (cadr j) (cadr k))))
           (setq r (1+ r))
           (mapcar '(lambda (c s) (set:text_ b r c 300 s))
                   '(0 1 2)
                   s
           )
         )
         (vla-put-RegenerateTableSuppressed b :vlax-false)
       )
  )
  (princ)
)
(vl-load-com)
;;                              ;;
(defun set:text_ (obj row col hgt str)
  (vla-settext obj row col str)
  (vla-setcelltextheight obj row col hgt)
  (vla-setcellalignment obj row col acmiddlecenter)
)
 
10
Thanks Al, sorry for late reply.. was on the beach all weekend. Works great, I could always filter the midpoints if I wanted to.
Pages: [1] 2 3 ... 10