Recent Posts

Pages: [1] 2 3 ... 10
1
AutoLISP (Vanilla / Visual) / Lisp to rename block
« Last post by like_citrus on Today at 01:23:38 AM »
Hi, using this code from CAD forum to rename a block.
(1) First the code is called up, then (2) you have to select the block to rename.

Is it possible to change so that it runs when you (1) select a block and then (2) code runs automatically for the block selected.
The block will be selected, then mouse-right-click and clicking on a custom menu button which runs the code.


Code: [Select]
(vl-load-com)

(defun C:RenameBlock (/ bent bobj oldn dblk match newn cmde)
  (while
    (not
      (and
        (setq bent (entsel "\nSelect Block to rename: ")) ; is selected
        (setq bent (entget (setq bobj (car bent))))
        (setq bobj (vlax-ename->vla-object bobj))
        (= (cdr (assoc 0 bent)) "INSERT") ; is a block
        (setq oldn (cdr (assoc 2 bent)))
        (not (assoc 1 (tblsearch "block" oldn))) ; not an xref
        (setq match (= (strcase oldn)(strcase (setq dblk (vla-get-effectivename bobj))))) ; not a dynamic block
      )
    )
    (prompt "\nNo static Block selected!")
  ) ; while
  (while
    (not
      (and
        (setq newn (getstring T (strcat "\nCurrent name = " oldn (if match "" (strcat " (" dblk ")")) ".  New Block name: ")))
        (not (tblsearch "block" newn)) ; not exists
        (or (= newn "")(snvalid newn)) ; not invalid
      )
    )
    (prompt "\nBlock name already exists or not valid!")
  )
  (if (> newn "") ; entered a new name
    (progn
      (setq cmde (getvar 'cmdecho))
      (setvar "cmdecho" 0)
      (command "_.rename" "_block" oldn newn)
      (prompt "\nRenamed.")
      (setvar "cmdecho" cmde)
    )
  ) ; if
  (princ)
) ; defun
2
We'll leave it as posted in case someone else has a similar problem.

Thanks for providing your resolution to the problem :)
3
It’s pretty easy to build a MSI installer in Visual Studio. No programming required, just added the source folder/files you want, and a target directory
Fill out the some fields in the (VS) properties panel. spend a half day learning it, then you can just whip them out easily 

A zip is cool but there’s no uninstall, also Inno setup is cool but .exe installers are out of fashion
4
AutoLISP (Vanilla / Visual) / Re: Do you use an autoloader bundle to deploy lisp?
« Last post by BIGAL on March 30, 2023, 11:35:18 PM »
A second option I use a zip file and a lisp to install software, you can unzip a file using lisp and save it to a known directory, So I have 3 sub directories in Zip also, the lisp continues sets paths, loads menus and so on.

Zip 85mb 196 files. Just drag the zip onto cad and select where you saved the zip.
5
AutoLISP (Vanilla / Visual) / Re: Do you use an autoloader bundle to deploy lisp?
« Last post by BIGAL on March 30, 2023, 11:27:34 PM »
For Jonh K

[/img]

You just need a sample bundle its all straight forward even in the XML easy to put your programs etc.
6
AutoLISP (Vanilla / Visual) / Re: Join objects inside blocks without using commands
« Last post by BIGAL on March 30, 2023, 11:01:21 PM »
Ouch 20,000 objects. maybe one way if you get the same objects is to reinsert an external block this will force a redefine block, the external block has the lines joined.
7
I just fixed it by setvar "DIMZIN" 0.
End of the topic. (I can't delete this topic).
8
Hi every one.
I'm using Lisp to insert value from .txt file in to AttBlock Autocad. However the number after comma doesn't displayed as set (2 number after comma), but instead the number of digits after the comma is the same as in the original .txt file.
In autolisp I was set (setvar "LUPREC" 2), the values insert were convert to text (rtos VALUE 2 2)
This issue only occurs in CAD 2024, and not in CAD 2007 or 2022
Please help me. Thanks.
9
AutoLISP (Vanilla / Visual) / Re: Do you use an autoloader bundle to deploy lisp?
« Last post by JohnK on March 30, 2023, 09:44:25 PM »
Still on the sidebar (KISS attempt): I just made a C program to pack all the .lsp files in a directory--and subdirectories--into a single file. :)
10
AutoLISP (Vanilla / Visual) / Re: Do you use an autoloader bundle to deploy lisp?
« Last post by kdub on March 30, 2023, 08:30:35 PM »
<< . . .

But it sure does sound like a fun project to create a "bundle builder". There you go Daniel! Drop down lists for all the variables!

Weird, I was thinking about that over NewYear !
I thought a database (SQLite) could be used to feed it.
Wouldn't (probably) need Acad.
Imagined it could be distributed on the App Store for a suitable renumeration.
Just need to make it as idiot proof as possible . . . and have 'good'  docs :)

. . but real life caught up with me.
Pages: [1] 2 3 ... 10