Jump to content

Recommended Posts

Posted

Hi, is it possible write a lisp to add the follow paths.

 

Tools->option -> support file seartch path

 

c:\topocad

c:\topocad\topohatch

c:\topocad\symbols

c:\topocad\trees

c:\topocad\lines

 

 

and

 

tools->option -> Default Template File New for QNew

 

c:\topocad\topocad.dwt

 

The problem is that when i load my menu i have a lot of path to add in Tools->option -> support file so i want a lisp to run it and add this paths.

 

Thanks

Posted

I dont see the use of a lisp since the paths you added will remain in cad everytime you open cad.

 

For the template why not added it to the already existing ones in the enu file so everytime you choose new drawing you will have to opportunity to select it?

Posted

i want a lisp to run in one time only after the first load of the menu

Posted

c:\topocad\topohatch

c:\topocad\symbols

c:\topocad\trees

c:\topocad\lines

 

Hatch differs from the already existing ones from cad?

Symbols and tress can be done in blocks and use insert commands to achieve the needs.

Lines are lines cad has them already unless special ones witch you can load after creating with notepad.

 

Unless i am mistaking or op is talking about special mnu related to a different program he needs to use.

Posted

I use an image slide menu and the files ,lines,trees,symbols is for my slides

Posted

you will load them only once , the lisp is not that needed unless you want to give your codes to others that you want to load them with the same lisp .

Posted

Something like this but i need a litle help

 

(defun c:setpaths()
(setq pref_files (vla-get-files (vla-get-preferences (vlax-get-acad-object))))
(setq paths
(apply 'strcat
(list

"C:\Users\Administrator\appdata\autodesk\autocad 2010\r18.0\enu\support;"
"C:\program files\autocad 2010\support;"
"C:\program files\autocad 2010\fonts;"
"C:\program files\autocad 2010\help;"
"C:\program files\autocad 2010\express;"
"C:\program files\autocad 2010\support\color;"

;I want to add only the follow not change all the other settings in the paths
"C:\topocad;"
"C:\topocad\lines;"
"C:\topocad\trees;"
"C:\topocad\symbols;"
"C:\topocad\topohatch;"
(getvar "ROAMABLEROOTPREFIX") ";"

(getvar "LOCALROOTPREFIX") ";"

))
)
; Default Template File for QNew
(vla-put-QNewTemplateFile pref_files "c:\topocad\topocad.dwt")
   (princ)
)

Posted

there is a few lisp experts among the forums members that can probably can help with the issue.

 

But would you not be better off with blocks for trees and symbols and lines loaded and generated with notepad and custom made hatches that can be generated with custom tool hatch command?

 

For the template if existing like i wrote simply add it to enu file template file and load it when cad is open and you use the new drawing option with template choosing the selected dwt file?

Posted
  prodromosm said:

I want to add only the follow not change all the other settings in the paths

Take a look at Lee Mac's LM:sfsp+ it may helps...

 

Henrique

Posted
  hmsilva said:
Take a look at Lee Mac's LM:sfsp+ it may helps...

 

This is obviously a great routine for adding paths on the fly (and accounting for duplicates, etc.), but in terms of CAD Standards enforcement for a production environment (i.e. either standardizing paths at startup, or preventing users from modifying, etc.), it is better to simply set the SupportPath Property in Acad.lsp in my experience, FWIW.

 

I originally learned to do this from R.K.'s article here: Setting support paths via lisp

 

... My $0.02

Posted

I think i fix it

 

(defun c:setpaths()
(vl-load-com)
; This sets a reference to the install path of your product
(setq acadloc
  (vl-registry-read
     (strcat "HKEY_LOCAL_MACHINE\\" (vlax-product-key))
  "ACADLOCATION")
); This sets a reference to the files portion of the acad preferences
(setq *files* (vla-get-files
  (vla-get-preferences (vlax-get-acad-object))
))
; This builds the string of support file search paths
(setq sfsp
      (strcat
 (getvar "ROAMABLEROOTPREFIX") "SUPPORT;"
 acadloc "\\SUPPORT;"
 acadloc "\\HELP;"
 acadloc "\\EXPRESS;"
 acadloc "\\SUPPORT\\COLOR;"
(getvar "LOCALROOTPREFIX") "SUPPORT;"
"C:\\topocad;"
"C:\\topocad\\lines;"
"C:\\topocad\\trees;"
"C:\\topocad\\symbols;"
"C:\\topocad\\topohatch;" 

      )
)
; This actually applies the above string to the current session of AutoCAD.
(vla-put-SupportPath *files* sfsp)
; Here are some examples of setting other things
; Set the template directory
;(vla-put-TemplateDwgPath *files* "\\\\SERVER\\CAD\\TEMPLATE")
; Set the default template (QNEW) name
(vla-put-QNewTemplateFile *files* "c:\\topocad\\topocad.dwt") 
; Set the printer (PC3) support file path
;(vla-put-PrinterConfigPath *files* "\\\\SERVER\\CAD\\PLOTTERS")
; Release the object
(vlax-release-object *files*)
   (princ)
)

 

Any advises for the code

 

Thanks

Posted

Here is a set lots of stuff within Config Files option includes printers etc look for vla-get-SupportPath in code for your request.

 

; resets the paths usefull for update versions of Autocad
; by Alan H 2011
; This sets a reference to the install path of your product
; the gets are their for info maybe other use
; use this to find other settings 
;(vlax-dump-object (vla-get-files (vla-get-preferences (vlax-get-Acad-object))) T)

(vl-load-com)
; make temp directory
;(vl-mkdir "c:\\AcadTEMP")

(setq *files*  (vla-get-files  (vla-get-preferences (vlax-get-Acad-object))))

; savepath
;(vla-get-AutoSavepath *files*)
(vla-put-AutoSavepath *files* "C:\\AcadTemp")

; custom icons
;(vla-get-CustomIconPath *files*))
(vla-put-CustomIconPath *files* "P:\\Autodesk\\ICONS")

; custom menu
;(vla-get-Menufile *files*))
;(vla-put-Menufile  *files* "C:\\Users\\2013BIGAL")

; printers config
;(vla-get-PrinterConfigPath *files*)
(vla-put-PrinterConfigPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles 2011")

; printers style sheet
;(vla-get-PrinterStyleSheetPath *files*)
(vla-put-PrinterStyleSheetPath *files* "P:\\AutoDESK\\Plotting\\Plot Styles")

; printer drv's
;(vla-get-PrinterDescPath *files*)
(vla-put-PrinterDescPath *files* "P:\\AutoDESK\\Plotting\\Drv")

; print spooler
;(vla-get-PrintSpoolerPath *files*)
(vla-put-PrintSpoolerPath *files* "C:\\AcadTemp\\")

; template  path
;(vla-get-TemplateDwgPath *files*)
(vla-put-TemplateDwgPath *files* "P:\\Autodesk\\c3d Templates")

; template location
;(vla-get-QnewTemplateFile *files*)
(vla-put-QnewTemplateFile *files* "P:\\Autodesk\\c3d Templates\\BIGAL.dwt")

;make new support paths exist + new
(setq paths (vla-get-SupportPath *files*))

(setq BIGALpaths 
 "P:\\autodesk\\supportfiles;
 P:\\autodesk\\lisp;
 P:\\autodesk\\fonts;
 P:\\autodesk\\hfs fonts;"
 )

(setq newpath (strcat BIGALpaths paths))
(vla-put-SupportPath *files* newpath)

; Tempdirectory 
;(vla-get-TempFilePath *files*))
(vla-put-TempFilePath *files* "C:\\AcadTemp\\")

;   PlotLogFilePath = "C:\\Documents and Settings\\ah02490.BIGAL-AD\\local 
settings\\application data\\autodesk\\c3d 2011\\enu\\"
(vla-put-PlotLogFilePath *files* "C:\\AcadTemp\\")

;   LogFilePath = "C:\\Documents and Settings\\ah02490.BIGAL-AD\\local 
settings\\application data\\autodesk\\c3d 2011\\enu\\"
(vla-put-LogFilePath *files* "C:\\AcadTemp\\")

; xref temp path
;(vla-get-TempXrefPath *files*))
(vla-put-TempXrefPath *files* "C:\\AcadTemp\\")

; end use of *files*
(vlax-release-object *files*)

; exit quitely
(princ "All Done")

Posted

(defun gxl-StrParse        (Str Delimiter / SearchStr StringLen return n char nn)
       (setq SearchStr Str)
       (setq StringLen (strlen SearchStr) nn StringLen)
       (setq return '())


       (while (> StringLen 0)
               (setq n 1)
               (setq char (substr SearchStr 1 1))
               (while (and (/= char Delimiter) (<= n nn))
                       (setq n (1+ n))
                       (setq char (substr SearchStr n 1))
               ) ;_ end of while
               (setq return (cons (substr SearchStr 1 (1- n)) return))
               (setq SearchStr (substr SearchStr (1+ n) StringLen))
               (setq StringLen (strlen SearchStr))
       ) ;_ end of while
    (if (= " " Delimiter)
      (setq return (vl-remove  "" return))
      )
       (reverse return)
)

 

;;(gxl-Sys-AddSupportPath "c:\\mypath" 2)

 

(defun gxl-Sys-AddSupportPath (dir pos / tmp c)
 (setq        tmp ""
       c   -1
 )
 (if (not pos)
   (setq tmp (strcat (getenv "ACAD") ";" dir))
   (mapcar '(lambda (x)
              (setq tmp (if (= (setq c (1+ c)) pos)
                          (strcat tmp ";" dir ";" x)
                          (strcat tmp ";" x)
                        )
              )
            )
           (gxl-StrParse (getenv "ACAD") ";")
   )
 )
 (setenv "ACAD" tmp)
 (princ)
)

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...