Visual LISP, AutoLISP and General Customization

Visual LISP, AutoLISP and General Customization

Reply
Member
rscamp13
Posts: 4
Registered: ‎12-01-2010
Message 1 of 8 (483 Views)
Accepted Solution

DCL lisp Routine

483 Views, 7 Replies
12-01-2010 11:41 AM

Can anyone help?  I have the following:

 

(defun RSplot (Title$ Question$ / Answer$ Dcl_Id% Return#)
  (princ "\nRSPlot")(princ)
  (vl-load-com)
  (setq Dcl_Id% (load_dialog "RSPlot.dcl"))
  (new_dialog "RSPlot" Dcl_Id%)
  (set_tile "Title" Title$)
  (set_tile "Text1" Question$)
  (action_tile "Freeze" "(done_dialog)(command ".layer" "_freeze" (strcat "KS-JK-Sig")"))
  (action_tile "Thaw" "(done_dialog 0)(command ".layer" "_thaw" (strcat "KS-JK-Sig")"))
  (setq Return# (start_dialog))
  (unload_dialog Dcl_Id%)
  (if (= Return# 1)
    (setq Answer$ "Freeze")
    (setq Answer$ "Thaw")
  )
  Answer$
);defun RSPlot
(princ)

 

Now for the DCL file:

 

RSPlot : dialog {
  key = "Title";
  label = "";//Title$ from lsp file
  spacer;
  : text {
    key = "Text1";
    label = "";//Question$ from lsp file
    width = 35.0;
    alignment = centered;
  }
  spacer;
  : row {
    fixed_width = true;
    alignment = centered;
    : button {
      key = "Freeze";
      label = "&Freeze";
      width = 7.92;
      fixed_width = true;
    }
    : button {
      key = "Thaw";
      label = "&Thaw";
      is_default = true;
      width = 7.92;
      fixed_width = true;
    }
  }
}//RSPlot

 

I get the miplaced dot on input message.  Any suggestions?

 

Thanks,

 

Rich Scampoli

*Expert Elite*
pbejse
Posts: 2,462
Registered: ‎11-24-2009
Message 2 of 8 (463 Views)

Re: DCL lisp Routine

12-01-2010 08:33 PM in reply to: rscamp13

Questiion for you,

why  (strcat "KS-JK-Sig")

 

Not sure if this is want you want to achieve , i would have done it this way.

 

(defun RSplot (Title$ Question$ / Answer$ Dcl_Id% Return#)
  (princ "\nRSPlot")(princ)
  (vl-load-com)
  (setq Dcl_Id% (load_dialog "RSPlot.dcl"))
  (new_dialog "RSPlot" Dcl_Id%)
  (set_tile "Title" Title$)
  (set_tile "Text1" Question$)
  (action_tile "Freeze" "(done_dialog 1)(setq  Answer$ \"Frozen\")")
  (action_tile "Thaw" "(done_dialog 1)(setq Answer$ \"Thawed\")")
  (start_dialog)
  (unload_dialog Dcl_Id%)
  (if (= Answer$ "Frozen")
     (command ".layer" "_freeze" "KS-JK-Sig" "")
  	(command ".layer" "_thaw" "KS-JK-Sig" ""))
   
    (princ (strcat "\nLayer KS-JK-Sig"  Answer$))(princ)
)

 Hope this helps

 

 

Distinguished Mentor
scottbolton
Posts: 638
Registered: ‎08-30-2005
Message 3 of 8 (441 Views)

Re: DCL lisp Routine

12-02-2010 02:00 AM in reply to: rscamp13

If you use the VLIDE to write your code you'd see the error straight away. Also, when you load the code and get the ";error: misplaced dot on input" message, if you double-click that message it will take you to the error in the code. Very nifty.

 

Anyroad, you're trying to put quotes inside quotes which you cannae do. You'll need something like:

 

(action_tile "Freeze" "(done_dialog)(command \".layer\" \"_freeze\" (strcat \"KS-JK-Sig\")")

 

S

Member
rscamp13
Posts: 4
Registered: ‎12-01-2010
Message 4 of 8 (431 Views)

Re: DCL lisp Routine

12-02-2010 06:05 AM in reply to: pbejse

pbejse,

 

Thank you so much.  That worked perfectly.  I am very new to lisp writing lisp.  I have to do more research on Visual lisp to help me, etc. but this gives me a great launching pad.  I cannot thank you enough.

 

Rich Scampoli

Member
rscamp13
Posts: 4
Registered: ‎12-01-2010
Message 5 of 8 (430 Views)

Re: DCL lisp Routine

12-02-2010 06:10 AM in reply to: scottbolton

Scott,

 

Thank you.   That is great to know.  As I said, I am very new to lisp so I hadn't realized my mistakes.

 

Rich Scampoli

 

 

 

 

Distinguished Contributor
andrew.nao
Posts: 189
Registered: ‎09-25-2008
Message 6 of 8 (427 Views)

Re: DCL lisp Routine

12-02-2010 06:15 AM in reply to: rscamp13

look into using open dcl much easier

Member
rscamp13
Posts: 4
Registered: ‎12-01-2010
Message 7 of 8 (422 Views)

Re: DCL lisp Routine

12-02-2010 06:30 AM in reply to: pbejse

Now another question, if I may.  I cannot seem to get this to work with my reactor:

 

(setq plot_rctr
(vlr-command-reactor nil '((:vlr-commandWillStart . StartPlot))))

(defun StartPlot (calling-reactor endcommandInfo / thecommandstart)

   (setq thecommandStart (nth 0 endcommandInfo))

    (if (= thecommandStart "PLOT")(RSPlot "Layer: KS-JK-Sig" "What would you like to do?")
    )
  )

 

Any ideas?

 

 

Distinguished Contributor
andrew.nao
Posts: 189
Registered: ‎09-25-2008
Message 8 of 8 (402 Views)

Re: DCL lisp Routine

12-02-2010 12:59 PM in reply to: rscamp13

im not that up on the reactors and since no where is the variable plot_rctr used in your code you posted

i would say

 

change this line

(setq plot_rctr
(vlr-command-reactor nil '((:vlr-commandWillStart . StartPlot))))

 

to

(vlr-command-reactor nil '((:vlr-commandWillStart . StartPlot)))

 

here is my reactor for saving on close maybe it will help ya

 

[code]

(setq App      (vlax-Get-Acad-Object)
      Doc      (vla-Get-ActiveDocument App)
      DwgProps (vla-Get-SummaryInfo Doc)
)

(setq Num (vla-NumCustomInfo DwgProps)) ;gets number of custom fields

 

(defun DoBeforeSave(/)
(vlr-command-reactor nil '((:vlr-commandWillStart . DoMyStuff)))
(princ)
)
(defun DoMyStuff (reactor params)
(if (= (strcase (car params)) "SAVEAS")
(progn

;;==============do stuff here
(if (> num 0)
(progn
         (vla-put-keywords dwgprops "")
         (vla-put-subject dwgprops "")
         (vla-put-Title dwgprops "")
         (vla-put-comments dwgprops "")
         (vla-put-author dwgprops "")


            (repeat num
                (vla-GetCustomByIndex DwgProps 0 'id 'value)

                   (if (vl-catch-all-apply
                'vla-removecustombykey
               (list dwgprops id)
                      )
                     (vla-addcustominfo dwgprops id "")

                   ) ;if
            ) ;repeat
 )
)
;;================

)
)
)

 

[/code]

Announcements
Are you familiar with the Autodesk Expert Elites? The Expert Elite program is made up of customers that help other customers by sharing knowledge and exemplifying an engaging style of collaboration. To learn more, please visit our Expert Elite website.
Need installation help?

Start with some of our most frequented solutions or visit the Installation and Licensing Forum to get help installing your software.