Search the Community
Showing results for tags 'bad argument'.
Erroreki posted a topic in AutoLISP, Visual LISP & DCLHi! Avid reader of the forums, first time poster. I have a code with which I'm trying to extract the x and y coordinate of the startpoint of a line to the clipboard for pasting into another program. The problem is that when I run the lisp in Civil 3D it spits out when running (caddr typelst) on line 6 in the code below. What could cause this. I'm having trouble understanding why it wouldn't be able to grab the type from the list. The code: (vl-load-com) (defun c:copyx1y1 () (setq choice (entsel "Choose the line whose start X and Y you want to copy \n")) (setq entname (car choice)) (setq typelst (assoc 0 (entget entname))) (if (= (caddr typelst) "LINE") (progn (setq startpnt (assoc 10 (entget entname))) (setq x1 (cadr startpnt)) (princ "\n") (princ x1) (princ "\n") (setq y1 (caddr startpnt)) (princ y1) (setq copiedtxt (strcat (rtos x1) "\t" (rtos y1))) (setq result (vlax-invoke (vlax-get (vlax-get (setq htmlfile (vlax-create-object "htmlfile")) 'ParentWindow) 'ClipBoardData) 'SetData "Text" copiedtxt) ) (vlax-release-object htmlfile) copiedtxt ) (progn (princ "The choice is not of type LINE") ) ) (princ) ) Regards, E
Greetings all! I recently wrote a routine that took information from the user via a dialog box and populated our titlemark block. After I got this working I wanted to add some additional functionality by having the user pick the viewport the titlemark would be associated with and by using a field populate the scale in the titlemark instead of having the user type in the input. I have attached my desired result. here is the code I am using, I think my problem area is in red. (defun C:TLMK ( / TLMK_LEN PT1) (setvar "CMDECHO" 0) (setq tempunits (getvar "insunits")) ;======================================================================================================================================== LOADS DIALOG BOX (defun TLMK(/ DCL_ID) (setq DCL_ID (load_dialog "n:/tuterj/AutoLISP/Working/TL-MK_Scale_add.DCL")) (if (not (new_dialog "TLMK" DCL_ID)) (exit)) (setq mark_n nil) (setq title_n nil) (action_tile "cancel" "(done_dialog) (exit)") (action_tile "mark_n" "(setq mark_n $value)") (action_tile "title_n" "(setq title_n $value)") (start_dialog) (unload_dialog DCL_ID) (princ) ) ;defun TLMK (TLMK) ;======================================================================================================================================== End of Dialog BOx [color=red](vl-load-com)[/color] [color=red](setq vpent (car (nentsel "\nselect viewport"))) ;user selects viewport and viewport id is stored under vpent[/color] [color=red](vlax-ename->vla-object vpent) ;vpent is transformed from an entity to a VLA object[/color] [color=red](setq scale_fld (strcat "%<\AcObjProp.16.2 Object(%<\_ObjId "(vl-princ-to-string(vla-get-Objectid vpent))">%).CustomScale \f\"%sn\">%")) ;assigns field expression to variable.[/color] (setq PT1 (getpoint "\nselect insertion point: ")) (setvar "ATTDIA" 0) (setq title_u (strcase title_n)) ;declaring additional variable to change case for title_n (setvar "insunits" 0) ;setting insertion units to unitless for proper scale of inserted block (command "insert" "N:/Tuterj/AutoLISP/Working/TitleMark-field.dwg" PT1 "" "" title_u scale_fld mark_n) ;inserting the contents of TitleMark drawing and inserting user input from dialog box. (setvar "ATTDIA" 1) (setvar "CMDECHO" 1) (setvar "insunits" tempunits) ) ;defun C:TLMK I have also attached the error I am getting when I try to run the routine. I would appriciate any help anyone is willing to provide. Thank you all for your time and for reading.