Jump to content

Problem in lisp .. please help


hosneyalaa

Recommended Posts

Sorry English is not good

Hello all the members

 

Problem in lisp ... please help

I have a lisp  that makes me wrong  at IntersectWith

"Command: ; error: ActiveX Server returned an error: Parameter not optional"

What's the reason
Please treatment the problem please

 

this lisp 

 

(defun c:lpp (/ entity pt acExtendBoth ANG ENT1 ENT2 HT LEV LEVI LEVIM LEVIP LW NPTYY NPTYYM NPTYYP P PLL PP PP1 PTPMIN1 X19 Y19 YI YIP acExtendNone FEAT FEATUR FILE LST LW P XI)
  (COMMAND "PDMODE" 35)
  (COMMAND "PDSIZE" 0.2)
 (setq lw (CAR(entsel "\nSelect the PROFILE LWPOLYLINE")))
 (setq lev (* 10 27.3))
 (setq pll (mapcar '(lambda ( p ) (trans (list (car p) (cadr p) (cdr (assoc 38 (entget lw)))) lw 0)) (mapcar 'cdr (vl-remove-if  '(lambda ( x ) (/= (car x) 10)) (entget lw)))))
 (setq x19(car(car pll)))
 (setq y19(cadr(car pll)))
(while
(setq pp (getpoint "\nSelect point on PROFILE : "))
(setq xi (- (car PP) x19))
(command "XLINE" "V" PP "")
            (setq ent1 (vlax-ename->vla-object lw)) 
                (setq ent2 (vlax-ename->vla-object (entlast))) 
                (setq PP1 (vlax-safearray->list (vlax-variant-value (vla-IntersectWith ent1 ent2 acExtendNone))))
                (entdel (entlast))
            (setq yi (- (cadr PP1) y19))
                (setq levi(/ (+ lev yi) 10))
                (setq ang (angle '(0.0 0.0 0.0) (vlax-curve-getfirstderiv lw (vlax-curve-getparamatpoint lw PP1))))
                (entmakex (list '(0 . "LINE")
(cons 10 (setq pt(polar PP1 (+ ang (/ pi 2.)) 0.3)))
(cons 11 (polar PP1 (- ang (/ pi 2.)) 0.3))
)
)
         (setq NPTYY (rtos levi))
    (command "text" "j" "ML" pt 0.3 90 NPTYY)
    (command "._Change" (entlast) "" "p" "color" "80" "")
(setq yip (- (cadr pp) y19))
(setq levip(/ (+ lev yip) 10))
(setq NPTYYp (rtos levip))
        (COMMAND "_.POINT" pp "")
    (command "text" "j" "ML" pp 0.3 90 NPTYYp)
    (command "._Change" (entlast) "" "p" "color" "80" "")
        (setq ptpmin1 (list (car pp) (+ (cadr pp) (/ (- (cadr pt) (cadr pp)) 2)) 0))
        (setq levim(- levi levip))
        (setq NPTYYm (rtos levim))
        (command "text" "j" "ML" ptpmin1 0.3 90 NPTYYm)


            (setq FEAT(LIST xi levi levip levim))
            (setq FEATUR(APPEND FEAT FEATUR))
) ;_ while

(setq lst  FEATUR)

  (if (setq    file (open (strcat (getvar 'dwgprefix)
                   "Lwpolyline Vertex List.csv"
               )
               "w"
             )
      )
    (progn
      (write-line (strcat "Distance" "," "LEVEL_NGL" "," "LEVEL_Manhal" "," "The difference") file)
          (repeat (/ (length lst) 4)
       (write-line
        (strcat    (rtos (car lst))
            ","
            (rtos (cadr lst))
            
            ","
            (rtos (caddr lst))
            
            ","
            (rtos (cadddr lst))
        )
        file
          )
          
          (setq lst (cddddr lst))
        )
      
      (close file)
      (alert "\nVertex Points exported to csv file.")
      (alert (strcat "File saved in - "
             (getvar 'dwgprefix)
             "Lwpolyline Vertex List.csv"
         )
      )
    )
    (alert "\nCSV file Currenty running, Close it first.")
      )
           

  
(princ)
) ;_ defun

 

 

profile lisp.dwg

Edited by hosneyalaa
Link to comment
Share on other sites

(defun c:lpp (/ entity pt acExtendBoth ANG ENT1 ENT2 HT LEV LEVI LEVIM LEVIP LW NPTYY NPTYYM NPTYYP P PLL PP PP1 PTPMIN1 X19 Y19 YI YIP acExtendNone FEAT FEATUR FILE LST LW P XI)

ERROR   :  acExtendBoth and acExtendNone are AutoCAD constants. You are defining them as local variables in the lisp so they are set to nil. This gives the error.

Solution Remove them from the local variable list.

 

 

 

Edited by dlanorh
  • Thanks 1
Link to comment
Share on other sites

14 hours ago, dlanorh said:

(defun c:lpp (/ entity pt acExtendBoth ANG ENT1 ENT2 HT LEV LEVI LEVIM LEVIP LW NPTYY NPTYYM NPTYYP P PLL PP PP1 PTPMIN1 X19 Y19 YI YIP acExtendNone FEAT FEATUR FILE LST LW P XI)

ERROR   :  acExtendBoth and acExtendNone are AutoCAD constants. You are defining them as local variables in the lisp so they are set to nil. This gives the error.

Solution Remove them from the local variable list.

 

thank you

Of this was the problem

acExtendBoth and acExtendNone

 

Link to comment
Share on other sites

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...