Author Topic: Lisp for this?  (Read 1125 times)

0 Members and 1 Guest are viewing this topic.

jlcin2024

  • Mosquito
  • Posts: 3
Lisp for this?
« on: January 12, 2024, 02:38:53 PM »
Is it possible to create a lisp routine for cad that could create a pop up menu from a directory on our server that would allow users to select detail .dwg files that would then be copied into a current project folder?  We have been xrefing or binding things, but this would really be ideal.  Anyone know of a .lsp like this or anything?

CodeDing

  • Newt
  • Posts: 60
Re: Lisp for this?
« Reply #1 on: January 12, 2024, 02:44:47 PM »
If anybody already has a solution for this, it's BIGAL.
Senior CAD Tech & AI Specialist
Need AutoLisp help?
Try my custom GPT 'AutoLISP Ace'

CodeDing

  • Newt
  • Posts: 60
Re: Lisp for this?
« Reply #2 on: January 12, 2024, 02:48:52 PM »
Might be worth looking into Lee Mac's 'Steal' program:

http://www.lee-mac.com/steal.html
Senior CAD Tech & AI Specialist
Need AutoLisp help?
Try my custom GPT 'AutoLISP Ace'

BIGAL

  • Swamp Rat
  • Posts: 1443
  • 40 + years of using Autocad
Re: Lisp for this?
« Reply #3 on: January 12, 2024, 08:49:34 PM »
Two ways using a bat file and simple copy command, the bat file made with lisp, but more suitable would be to use (vl-file-copy oldfile newfile)

If the dwg files are say detail files in a known location, then can read all the dwg names into a list box, I would suggest use Lee-mac double list box as it has a select option and shows on right selected items.  So then use vl-filecopy on the list.
Hint (setq dwgs (vl-directory-files "d:\\acadtemp" "*.dwg" 1))

Added to my To do list.

Lee Mac please trying to find it again
A man who never made a mistake never made anything

jlcin2024

  • Mosquito
  • Posts: 3
Re: Lisp for this?
« Reply #4 on: January 15, 2024, 10:43:47 AM »
Thank you guys so much for helping with this!  It is challenging being the one guy at the firm (to my knowledge) who is trying to employ creative means (lsp, scripts, w/e) to be efficient and productive whilst learning the industry-side data so I admire you all for having done it and still giving back to help others.  I have a ton of Lee's stuff, all of it is great, and I will def try to look into your suggestion BIGAL, hopefully I can figure it out. 

Seriously, not trying to blow too much smoke anywhere it shouldn't be, just really grateful for the feedback and assistance!

BIGAL

  • Swamp Rat
  • Posts: 1443
  • 40 + years of using Autocad
Re: Lisp for this?
« Reply #5 on: January 15, 2024, 09:23:58 PM »
If the detail dwgs are like this can group we had like 300 blocks. They were individual, please pick based on the type of detail grouped, picking image would auto insert the dwg as dwg file location is known.


« Last Edit: January 15, 2024, 09:28:15 PM by BIGAL »
A man who never made a mistake never made anything

jlcin2024

  • Mosquito
  • Posts: 3
Re: Lisp for this?
« Reply #6 on: January 16, 2024, 03:59:25 PM »
Yes, that would be sweet!  Essentially, I'm trying to let the engineers be able to quickly select and insert the details from our library into the current project.  We were using x-ref - bind but this would be more user friendly and awesome!  How can I do it like your photo?

BIGAL

  • Swamp Rat
  • Posts: 1443
  • 40 + years of using Autocad
Re: Lisp for this?
« Reply #7 on: January 16, 2024, 06:38:38 PM »
Each image is a dwg, that sounds like your situation. The images are slides which are made using the SLIDE command. The menu a mnu file is made in Notepad. Then use menuload to load it. Ok a quick MNU explanation you can have sub menus -> <-, you can have an Images section, a Toolbar section and a digitiser section. You make a slide of each detail, I do this with a script make like 100 in one go, open dwg, make slide, close, next dwg. You can add the sld's to a slide library this way you have 1 file rather than a 100.

So have a go at making a couple of slides ie SLIDE & VSLIDE to see result.

With the introduction of high resolution screens the Slide command can make tiny slides, so to get around that problem, shrink your cad screen down to like a 1/4 size in a corner, then make slide.

Its easy to make the mnu but I dont know your detail names etc so have a go at making a mnu and post here, do not menuload, if the mnu is done badly it can screw up your menus. So post so can look at it.

The slides are say SD301.sld.

Code: [Select]
***MENUGROUP=STDS

***POP20
**CADLIB
             [LIBRARY]
             [->Stddwgs]
             [TRENCH]$I=XXXSTDS.TRENCH $I=*
             [PIPES]$I=XXXSTDS.PIPES $I=*
             [PITS]$I=XXXSTDS.PITS $I=*
             [KERBS]$I=XXXSTDS.KERBS $I=*
             [ROADX]$I=XXXSTDS.ROADX $I=*
             [PAVEMENTS]$I=XXXSTDS.PAVEMENT $I=*
             [MISC]$I=XXXSTDS.MISC $I=*
[<-]
             [->IDM dwgs]
             [TRENCH]$I=XXXSTDS.IDMTRENCH $I=*
             [PIPES]$I=XXXSTDS.IDMPIPES $I=*
             [PITS]$I=XXXSTDS.IDMPITS $I=*
             [KERBS]$I=XXXSTDS.IDMKERBS $I=*
             [ROADX]$I=XXXSTDS.IDMROADX $I=*
             [PAVEMENTS]$I=XXXSTDS.IDMPAVEMENT $I=*
[<-]
[->SURVEY dwgs]
             [SHEETS]$I=XXXSTDS.SURVEY $I=*
[<-]
             [->LISP1 A-B]
             [1/4 POINTS]^C^C(LOAD "1-4 POINTS")
             [Add 2 Level]^C^C(LOAD "add-to-levels")
             [Add-pits-drain]^C^C(LOAD"Add-pits-drain")
             [Allbylayer]^C^C(LOAD "Allbylayer")
             [Andy Sig]^c^c^p(Load "Andysig")
             [Apndtext]^C^C^p(LOAD "apndtext")
             [Apparent int]^C^C^p(LOAD "apparent int")

***image

**PITS
[PITS]
[XXXSLD(SD301,PIT DIM  SET OUT)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG301")
[XXXSLD(SD302,UNHAUNCHED)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG302")
[XXXSLD(SD303,HAUNCHED)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG303") 
[XXXSLD(SD304,MIN WALL THICK)]^C^C(openblk "P:/ACADSTDS/CIVIL STANDARDS/CGG304")



Code: [Select]
***MENUGROUP=ALANSTOOLBAR
***TOOLBARS
**ALANSTOOLS
ID_ALAN_0    [_Toolbar("Alans1", _Right, _Show, 0, 0, 1)]
AECC_ShowTS  [_Button("Show Toolspace", RCDATA_16_IMAGE, RCDATA_16_IMAGE)]^C^C^C^P_ShowTS
ID_Matchprop [_Button("Match Properties", RCDATA_16_MATCH, RCDATA_16_MATCH)]^C^C_matchprop
ID_Erase     [_Button("Erase", RCDATA_16_ERASE, RCDATA_32_ERASE)]^C^C_erase
ID_Copy      [_Button("Copy", RCDATA_16_COPYOB, RCDATA_32_COPYOB)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_copy,^C^C_copy)
ID_Mirror    [_Button("Mirror", RCDATA_16_MIRROR, RCDATA_32_MIRROR)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_mirror,^C^C_mirror)
ID_Offset    [_Button("Offset", RCDATA_16_OFFSET, RCDATA_32_OFFSET)]^C^C_offset
ID_Array     [_Button("Array...", RCDATA_16_ARRREC, RCDATA_32_ARRREC)]^C^C_array
ID_Move      [_Button("Move", RCDATA_16_MOVE, RCDATA_32_MOVE)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_move,^C^C_move)
ID_Rotate    [_Button("Rotate", RCDATA_16_ROTATE, RCDATA_32_ROTATE)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_rotate,^C^C_rotate)
ID_Scale     [_Button("Scale", RCDATA_16_SCALE, RCDATA_32_SCALE)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_scale,^C^C_scale)
ID_Stretch   [_Button("Stretch", RCDATA_16_STRETC, RCDATA_32_STRETC)]$M=$(if,$(eq,$(substr,$(getvar,cmdnames),1,4),GRIP),_stretch,^C^C_stretch)
A man who never made a mistake never made anything

framednlv

  • Newt
  • Posts: 65
Re: Lisp for this?
« Reply #8 on: May 13, 2024, 06:46:51 PM »
We use design center
Code: [Select]
(defun c:EE ()(command "_adcnavigate" "X:/Standards/Disciplines/E/")(setvar 'clayer "0")(print "layer '0' is now current")(princ))
(defun c:MM ()(command "_adcnavigate" "X:/Standards/Disciplines/M/")(setvar 'clayer "0")(print "layer '0' is now current")(princ))
(defun c:PP ()(command "_adcnavigate" "X:/Standards/Disciplines/P/")(setvar 'clayer "0")(print "layer '0' is now current")(princ))