Author Topic: Opening a drawing with lisp  (Read 3247 times)

0 Members and 1 Guest are viewing this topic.

Ricky S

  • Newt
  • Posts: 24
Opening a drawing with lisp
« on: June 07, 2011, 09:23:01 AM »
Hey guys, I need a little help. I pieced together the following code to replace an old vba routine.  It opens my drawing, but it is not active, how can I make my "Titleblk.dwg" the active drawing?

(defun c:ttblock ()
(vl-load-COM)
(setq App (vlax-get-acad-object))
(setq Docs (vla-get-documents App))
(vla-open Docs "C:/Projects/Current/A&B Templates/Titleblk.dwg")
(princ)            ; Clear the command line
)

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Opening a drawing with lisp
« Reply #1 on: June 07, 2011, 09:39:31 AM »
(vla-activate (vla-open ...
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Ricky S

  • Newt
  • Posts: 24
Re: Opening a drawing with lisp
« Reply #2 on: June 07, 2011, 10:16:57 AM »
Thanks alanjt...DUH  :oops:  I have a hard time with "vl" stuff, I bet it took me 2 hours to figure out the original code, you've saved me some time this morning!  Thanks again

alanjt

  • Needs a day job
  • Posts: 5352
  • Standby for witty remark...
Re: Opening a drawing with lisp
« Reply #3 on: June 07, 2011, 10:17:30 AM »
Anytime. :)
Civil 3D 2019 ~ Windohz 7 64bit
Dropbox

Lee Mac

  • Seagull
  • Posts: 12926
  • London, England
Re: Opening a drawing with lisp
« Reply #4 on: June 07, 2011, 12:17:49 PM »

efernal

  • Bull Frog
  • Posts: 206
Re: Opening a drawing with lisp
« Reply #5 on: June 07, 2011, 01:00:54 PM »
lm:open enumeration...

Code: [Select]
;|
typedef enum  {
  ssfALTSTARTUP         = 0x1d, ; 29
  ssfAPPDATA            = 0x1a, ; 26
  ssfBITBUCKET          = 0x0a, ; 10
  ssfCOMMONALTSTARTUP   = 0x1e, ; 30
  ssfCOMMONAPPDATA      = 0x23, ; 35
  ssfCOMMONDESKTOPDIR   = 0x19, ; 25
  ssfCOMMONFAVORITES    = 0x1f, ; 31
  ssfCOMMONPROGRAMS     = 0x17, ; 23
  ssfCOMMONSTARTMENU    = 0x16, ; 22
  ssfCOMMONSTARTUP      = 0x18, ; 24
  ssfCONTROLS           = 0x03, ; 3
  ssfCOOKIES            = 0x21, ; 33
  ssfDESKTOP            = 0x00, ; 0
  ssfDESKTOPDIRECTORY   = 0x10, ; 16
  ssfDRIVES             = 0x11, ; 17
  ssfFAVORITES          = 0x06, ; 6
  ssfFONTS              = 0x14, ; 20
  ssfHISTORY            = 0x22, ; 34
  ssfINTERNETCACHE      = 0x20, ; 32
  ssfLOCALAPPDATA       = 0x1c, ; 28
  ssfMYPICTURES         = 0x27, ; 39
  ssfNETHOOD            = 0x13, ; 19
  ssfNETWORK            = 0x12, ; 18
  ssfPERSONAL           = 0x05, ; 5
  ssfPRINTERS           = 0x04, ; 4
  ssfPRINTHOOD          = 0x1b, ; 27
  ssfPROFILE            = 0x28, ; 40
  ssfPROGRAMFILES       = 0x26, ; 38
  ssfPROGRAMFILESx86    = 0x30, ; 48
  ssfPROGRAMS           = 0x02, ; 2
  ssfRECENT             = 0x08, ; 8
  ssfSENDTO             = 0x09, ; 9
  ssfSTARTMENU          = 0x0b, ; 11
  ssfSTARTUP            = 0x07, ; 7
  ssfSYSTEM             = 0x25, ; 37
  ssfSYSTEMx86          = 0x29, ; 41
  ssfTEMPLATES          = 0x15, ; 21
  ssfWINDOWS            = 0x24  ; 36
} ShellSpecialFolderConstants;
|;
e.fernal

HofCAD

  • Guest
Re: Opening a drawing with lisp
« Reply #6 on: June 08, 2011, 03:34:42 AM »
With the Dynamic Data Exchange (DDE) method interface.
Unzip 'DDE-Open Sample Files.zip' in 'c:\Temp' and
open AutoCAD and DDE-Open.xls.
Make your choice and click on the button 'OpenFile'.

Regards HofCAD CSI.

PS1 Instead of using Visual Lisp you can also use the command BROWSER
and you can also use this with the Dynamic Data Exchange (DDE) method interface.

Code: [Select]
(defun c:TitOpen()
(command "_.BROWSER" "C:/Projects/Current/A&B Templates/Titleblk.dwg")
)

PS2 In DDE-OpenAll.xls is Open Enumeration for ShellSpecialFolder constants added.
http://technet.microsoft.com/en-us/library/ee176604.aspx
« Last Edit: June 14, 2011, 01:16:23 PM by HofCAD »