Visual LISP, AutoLISP and General Customization
cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

DCL lisp Routine

7 REPLIES 7
SOLVED
Reply
Message 1 of 8
rscamp13
799 Views, 7 Replies

DCL lisp Routine

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

7 REPLIES 7
Message 2 of 8
pbejse
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

 

 

Message 3 of 8
scottbolton
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

Message 4 of 8
rscamp13
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

Message 5 of 8
rscamp13
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

 

 

 

 

Message 6 of 8
andrew.nao
in reply to: rscamp13

look into using open dcl much easier

Message 7 of 8
rscamp13
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?

 

 

Message 8 of 8
andrew.nao
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]

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk Design & Make Report

”Boost