Jump to content

Missing Digit


mfahadrazzaq

Recommended Posts

Salaam to all Members,

 

mujy ik problem darpash hy ma Lisp ki Command use kr raha hn PRL ki

so mujy 3 digit chahiye bt ya command sirf 2 digit dy rahi hai so any one help me ...... Regards

 

 

Fahad Razzaq

Link to comment
Share on other sites

  • Replies 22
  • Created
  • Last Reply

Top Posters In This Topic

  • mfahadrazzaq

    13

  • MSasu

    9

  • krkan

    1

Top Posters In This Topic

I'm afraid that your message is incomprehensible; didn't had luck with Google Translate either. Sorry, but really not sure how to help you.

Can you try to post a picture of what you are talking about? Or, if is an AutoLISP issue, an excerpt of code?

Link to comment
Share on other sites

Hi Dear,

 

i have a problem when i applied Lisp command of PRL for this i required three digits bt this command shows 2 digits wht i can i do... ...... Regards

Link to comment
Share on other sites

Then, are you allowed to post the code here? This way will be much easier to debug it.

If not, what type of entity is the one that you want to increase the precision? Is a text/mtext label or is a dimension?

Link to comment
Share on other sites

It depends of how the value of the label is created. For this reason it was helpful to see the code. If the number was passed to a command call as a real, then you may fix this by adjusting the LUPREC system variable. If was converted to a string, then search in code for a statement like below:

(rtos [color=dimgray][b]...[/b][/color] 2)

Where "..." part may be anything; when locate that try changing 2 with 3 and see if helps.

 

Alternatively, please try to locate into the code a part that contains the string "MTEXT" (with quotes) and post at least that part here.

Link to comment
Share on other sites

;;; 12345678901234567890123456789012345678901234567890
;;; VERTEXT.LSP  A program to extract the xyz
;;; coordinates from any polyline and export them
;;; to an ascii file.

(defun ERR (S)
  (if (= S "Function cancelled")
     (princ "\nVERTEXT - cancelled: ")
     (progn (princ "\nVERTEXT - Error: ") (princ S) (terpri)) ;_ progn
  ) ; if
  (RESETTING)
  (princ "SYSTEM VARIABLES have been reset\n")
  (princ)
) ; err
(defun SETV (SYSTVAR NEWVAL)
  (setq X (read (strcat SYSTVAR "1")))
  (set X (getvar SYSTVAR))
  (setvar SYSTVAR NEWVAL)
) ; setv 
(defun SETTING ()
  (setq OERR *ERROR*)
  (setq *ERROR* ERR)
  (SETV "CMDECHO" 0)
  (SETV "BLIPMODE" 0)
) ; end of setting 
(defun RSETV (SYSTVAR) (setq X (read (strcat SYSTVAR "1"))) (setvar SYSTVAR (eval X)))
; restv
(defun RESETTING () (RSETV "CMDECHO") (RSETV "BLIPMODE") (setq *ERROR* OERR))
; end of resetting 

(defun DXF (CODE ENAME) (cdr (assoc CODE (entget ENAME)))) ; dxf

(defun VERTEXT (/ EN VLIST)
  (setq EN (GET-EN))
  (if (= (DXF 0 EN) "LWPOLYLINE")
     (setq VLIST (GET-LWVLIST EN))
     (setq VLIST (GET-PLVLIST EN))
  ) ; if
  (WRITE-IT VLIST EN)
) ;_ vertext

(defun GET-EN (/ NO-ENT EN MSG1 MSG2)
  (setq NO-ENT 1
        EN     NIL
        MSG1   "\nSelect a polyline: "
        MSG2   "\nNo polyline selected, try again."
  ) ; setq
  (while NO-ENT
     (setq EN (car (entsel MSG1)))
     (if (and EN
              (or (= (DXF 0 EN) "LWPOLYLINE") (= (DXF 0 EN) "POLYLINE")) ; or
         ) ; and
        (progn (setq NO-ENT NIL)) ; progn
        (prompt MSG2)
     ) ; if
  ) ; while
  EN
) ; get-en

(defun GET-LWVLIST (EN / ELIST NUM-VERT VLIST)
  (setq ELIST    (entget EN)
        NUM-VERT (cdr (assoc 90 ELIST))
        ELIST    (member (assoc 10 ELIST) ELIST)
        VLIST    NIL
  ) ; setq
  (repeat NUM-VERT
     (setq VLIST (append VLIST (list (cdr (assoc 10 ELIST)))) ; append
     ) ; setq
     (setq ELIST (cdr ELIST)
           ELIST (member (assoc 10 ELIST) ELIST)
     ) ; setq
  ) ; repeat
  VLIST
) ; get-lwvlist

(defun GET-PLVLIST (EN / VLIST)
  (setq VLIST NIL
        EN    (entnext EN)
  ) ; setq
  (while (/= "SEQEND" (DXF 0 EN))
     (setq VLIST (append VLIST (list (DXF 10 EN))))
     (setq EN (entnext EN))
  ) ; while
  VLIST
) ; get-plvlist

(defun WRITE-IT (VLST EN / NEWVLIST MSG3 FNAME)
  (setq NEWVLIST (mapcar '(lambda (X) (trans X EN 0)) ;_ lambda
                         VLST
                 ) ;_ mapcar
        MSG3     "Polyline vertex file"
       ;FNAME    (getfiled MSG3 "" "txt" 1)
        F1       (open "FNAME" "w")
  ) ; setq
  (WRITE-HEADER)
  (WRITE-VERTICES NEWVLIST)
  (setq F1 (close F1))
) ;_ write-it

(defun WRITE-HEADER (/ STR)
 (setq STR "        POLYLINE VERTEX POINTS")
  (write-line STR F1)
 (setq STR (strcat "  X            " "  Y            " "  Z") ;_ strcat
  ) ;_ setq
  (write-line STR F1)
) ;_ write-header


(defun WRITE-VERTICES (NEWVLIST / XSTR YSTR ZSTR STR)

;***************************************************************************
;***************************************************************************
;***************************************************************************
;Change   The   Text   Height   in   Next   Row   Figure

(setq httt "1.5") 
;***************************************************************************
;***************************************************************************
;***************************************************************************


(setq gptx (getpoint "\nBasepoint for X axis: "))
(setq gpty (getpoint "\nBasepoint for Y axis: "))

  (foreach ITEM NEWVLIST
     (setq XSTR (rtos (nth 0 ITEM) 3 3)
           YSTR (rtos (nth 1 ITEM) 3 3)
           ZSTR (rtos (nth 2 ITEM) 3 3)
           STR  (strcat XSTR (SPACES XSTR) YSTR (SPACES YSTR) ZSTR) ;_ strcat
     ) ; setq
;      (write-line STR F1)



(command "Mtext" (list (+(atof xstr)(/ (atof httt) 3.0)) (cadr gptx)) httt "90" (strcat xstr))
(command "Mtext" (list (+(atof xstr)(/ (atof httt) 3.0)) (cadr gpty)) httt "90" (strcat ystr))

  ) ; foreach

) ; write-vertices


(defun SPACES (STR / FIELD NUM CHAR SPACE)
  (setq FIELD 15
        NUM   (- FIELD (strlen STR))
        CHAR  " "
        SPACE ""
  ) ;_ setq
  (repeat NUM (setq SPACE (strcat SPACE CHAR))) ;_ repeat
) ;_ spaces

(defun C:prl () (SETTING) (VERTEXT) (RESETTING) (princ)) ; c:nsl

(prompt "\nwritten Azmat Ali 03317605164")
(prompt "\nCommand: PRL to Start ")

Link to comment
Share on other sites

;;; 12345678901234567890123456789012345678901234567890
;;; VERTEXT.LSP  A program to extract the xyz
;;; coordinates from any polyline and export them
;;; to an ascii file.

(defun ERR (S)
  (if (= S "Function cancelled")
     (princ "\nVERTEXT - cancelled: ")
     (progn (princ "\nVERTEXT - Error: ") (princ S) (terpri)) ;_ progn
  ) ; if
  (RESETTING)
  (princ "SYSTEM VARIABLES have been reset\n")
  (princ)
) ; err
(defun SETV (SYSTVAR NEWVAL)
  (setq X (read (strcat SYSTVAR "1")))
  (set X (getvar SYSTVAR))
  (setvar SYSTVAR NEWVAL)
) ; setv 
(defun SETTING ()
  (setq OERR *ERROR*)
  (setq *ERROR* ERR)
  (SETV "CMDECHO" 0)
  (SETV "BLIPMODE" 0)
) ; end of setting 
(defun RSETV (SYSTVAR) (setq X (read (strcat SYSTVAR "1"))) (setvar SYSTVAR (eval X)))
; restv
(defun RESETTING () (RSETV "CMDECHO") (RSETV "BLIPMODE") (setq *ERROR* OERR))
; end of resetting 

(defun DXF (CODE ENAME) (cdr (assoc CODE (entget ENAME)))) ; dxf

(defun VERTEXT (/ EN VLIST)
  (setq EN (GET-EN))
  (if (= (DXF 0 EN) "LWPOLYLINE")
     (setq VLIST (GET-LWVLIST EN))
     (setq VLIST (GET-PLVLIST EN))
  ) ; if
  (WRITE-IT VLIST EN)
) ;_ vertext

(defun GET-EN (/ NO-ENT EN MSG1 MSG2)
  (setq NO-ENT 1
        EN     NIL
        MSG1   "\nSelect a polyline: "
        MSG2   "\nNo polyline selected, try again."
  ) ; setq
  (while NO-ENT
     (setq EN (car (entsel MSG1)))
     (if (and EN
              (or (= (DXF 0 EN) "LWPOLYLINE") (= (DXF 0 EN) "POLYLINE")) ; or
         ) ; and
        (progn (setq NO-ENT NIL)) ; progn
        (prompt MSG2)
     ) ; if
  ) ; while
  EN
) ; get-en

(defun GET-LWVLIST (EN / ELIST NUM-VERT VLIST)
  (setq ELIST    (entget EN)
        NUM-VERT (cdr (assoc 90 ELIST))
        ELIST    (member (assoc 10 ELIST) ELIST)
        VLIST    NIL
  ) ; setq
  (repeat NUM-VERT
     (setq VLIST (append VLIST (list (cdr (assoc 10 ELIST)))) ; append
     ) ; setq
     (setq ELIST (cdr ELIST)
           ELIST (member (assoc 10 ELIST) ELIST)
     ) ; setq
  ) ; repeat
  VLIST
) ; get-lwvlist

(defun GET-PLVLIST (EN / VLIST)
  (setq VLIST NIL
        EN    (entnext EN)
  ) ; setq
  (while (/= "SEQEND" (DXF 0 EN))
     (setq VLIST (append VLIST (list (DXF 10 EN))))
     (setq EN (entnext EN))
  ) ; while
  VLIST
) ; get-plvlist

(defun WRITE-IT (VLST EN / NEWVLIST MSG3 FNAME)
  (setq NEWVLIST (mapcar '(lambda (X) (trans X EN 0)) ;_ lambda
                         VLST
                 ) ;_ mapcar
        MSG3     "Polyline vertex file"
       ;FNAME    (getfiled MSG3 "" "txt" 1)
        F1       (open "FNAME" "w")
  ) ; setq
  (WRITE-HEADER)
  (WRITE-VERTICES NEWVLIST)
  (setq F1 (close F1))
) ;_ write-it

(defun WRITE-HEADER (/ STR)
 (setq STR "        POLYLINE VERTEX POINTS")
  (write-line STR F1)
 (setq STR (strcat "  X            " "  Y            " "  Z") ;_ strcat
  ) ;_ setq
  (write-line STR F1)
) ;_ write-header


(defun WRITE-VERTICES (NEWVLIST / XSTR YSTR ZSTR STR)

;***************************************************************************
;***************************************************************************
;***************************************************************************
;Change   The   Text   Height   in   Next   Row   Figure

(setq httt "1.5") 
;***************************************************************************
;***************************************************************************
;***************************************************************************


(setq gptx (getpoint "\nBasepoint for X axis: "))
(setq gpty (getpoint "\nBasepoint for Y axis: "))

  (foreach ITEM NEWVLIST
     (setq XSTR (rtos (nth 0 ITEM) 3 3)
           YSTR (rtos (nth 1 ITEM) 3 3)
           ZSTR (rtos (nth 2 ITEM) 3 3)
           STR  (strcat XSTR (SPACES XSTR) YSTR (SPACES YSTR) ZSTR) ;_ strcat
     ) ; setq
;      (write-line STR F1)



(command "Mtext" (list (+(atof xstr)(/ (atof httt) 3.0)) (cadr gptx)) httt "90" (strcat xstr))
(command "Mtext" (list (+(atof xstr)(/ (atof httt) 3.0)) (cadr gpty)) httt "90" (strcat ystr))

  ) ; foreach

) ; write-vertices


(defun SPACES (STR / FIELD NUM CHAR SPACE)
  (setq FIELD 15
        NUM   (- FIELD (strlen STR))
        CHAR  " "
        SPACE ""
  ) ;_ setq
  (repeat NUM (setq SPACE (strcat SPACE CHAR))) ;_ repeat
) ;_ spaces

(defun C:prl () (SETTING) (VERTEXT) (RESETTING) (princ)) ; c:nsl

(prompt "\nwritten Azmat Ali 03317605164")
(prompt "\nCommand: PRL to Start ")



Link to comment
Share on other sites

Please be patient. I will take a look on your code, but this will take a while. Maybe someone else will investigate it too and post a solution sooner.

Link to comment
Share on other sites

Please tell me, what do you expect this program to do? It seems that it should list the vertex coordinates of a polyline, but what should be made with those data?

At this time it is just writing a header to a file named "FNAME" saved into current folder (but no other data) and attempts to draw a kind of table (but with overlapped lines) operation which fail due to poor syntax.

Link to comment
Share on other sites

wait i send again

 

;;; 12345678901234567890123456789012345678901234567890
;;; VERTEXT.LSP  A program to extract the xyz
;;; coordinates from any polyline and export them
;;; to an ascii file.

(defun ERR (S)
  (if (= S "Function cancelled")
     (princ "\nVERTEXT - cancelled: ")
     (progn (princ "\nVERTEXT - Error: ") (princ S) (terpri)) ;_ progn
  ) ; if
  (RESETTING)
  (princ "SYSTEM VARIABLES have been reset\n")
  (princ)
) ; err
(defun SETV (SYSTVAR NEWVAL)
  (setq X (read (strcat SYSTVAR "1")))
  (set X (getvar SYSTVAR))
  (setvar SYSTVAR NEWVAL)
) ; setv 
(defun SETTING ()
  (setq OERR *ERROR*)
  (setq *ERROR* ERR)
  (SETV "CMDECHO" 0)
  (SETV "BLIPMODE" 0)
) ; end of setting 
(defun RSETV (SYSTVAR) (setq X (read (strcat SYSTVAR "1"))) (setvar SYSTVAR (eval X)))
; restv
(defun RESETTING () (RSETV "CMDECHO") (RSETV "BLIPMODE") (setq *ERROR* OERR))
; end of resetting 

(defun DXF (CODE ENAME) (cdr (assoc CODE (entget ENAME)))) ; dxf

(defun VERTEXT (/ EN VLIST)
  (setq EN (GET-EN))
  (if (= (DXF 0 EN) "LWPOLYLINE")
     (setq VLIST (GET-LWVLIST EN))
     (setq VLIST (GET-PLVLIST EN))
  ) ; if
  (WRITE-IT VLIST EN)
) ;_ vertext

(defun GET-EN (/ NO-ENT EN MSG1 MSG2)
  (setq NO-ENT 1
        EN     NIL
        MSG1   "\nSelect a polyline: "
        MSG2   "\nNo polyline selected, try again."
  ) ; setq
  (while NO-ENT
     (setq EN (car (entsel MSG1)))
     (if (and EN
              (or (= (DXF 0 EN) "LWPOLYLINE") (= (DXF 0 EN) "POLYLINE")) ; or
         ) ; and
        (progn (setq NO-ENT NIL)) ; progn
        (prompt MSG2)
     ) ; if
  ) ; while
  EN
) ; get-en

(defun GET-LWVLIST (EN / ELIST NUM-VERT VLIST)
  (setq ELIST    (entget EN)
        NUM-VERT (cdr (assoc 90 ELIST))
        ELIST    (member (assoc 10 ELIST) ELIST)
        VLIST    NIL
  ) ; setq
  (repeat NUM-VERT
     (setq VLIST (append VLIST (list (cdr (assoc 10 ELIST)))) ; append
     ) ; setq
     (setq ELIST (cdr ELIST)
           ELIST (member (assoc 10 ELIST) ELIST)
     ) ; setq
  ) ; repeat
  VLIST
) ; get-lwvlist

(defun GET-PLVLIST (EN / VLIST)
  (setq VLIST NIL
        EN    (entnext EN)
  ) ; setq
  (while (/= "SEQEND" (DXF 0 EN))
     (setq VLIST (append VLIST (list (DXF 10 EN))))
     (setq EN (entnext EN))
  ) ; while
  VLIST
) ; get-plvlist

(defun WRITE-IT (VLST EN / NEWVLIST MSG3 FNAME)
  (setq NEWVLIST (mapcar '(lambda (X) (trans X EN 0)) ;_ lambda
                         VLST
                 ) ;_ mapcar
        MSG3     "Polyline vertex file"
       ;FNAME    (getfiled MSG3 "" "txt" 1)
        F1       (open "FNAME" "w")
  ) ; setq
  (WRITE-HEADER)
  (WRITE-VERTICES NEWVLIST)
  (setq F1 (close F1))
) ;_ write-it

(defun WRITE-HEADER (/ STR)
 (setq STR "        POLYLINE VERTEX POINTS")
  (write-line STR F1)
 (setq STR (strcat "  X            " "  Y            " "  Z") ;_ strcat
  ) ;_ setq
  (write-line STR F1)
) ;_ write-header


(defun WRITE-VERTICES (NEWVLIST / XSTR YSTR ZSTR STR)

;***************************************************************************
;***************************************************************************
;***************************************************************************
;Change   The   Text   Height   in   Next   Row   Figure

(setq httt "1.5") 
;***************************************************************************
;***************************************************************************
;***************************************************************************


(setq gptx (getpoint "\nBasepoint for X axis: "))
(setq gpty (getpoint "\nBasepoint for Y axis: "))

  (foreach ITEM NEWVLIST
     (setq XSTR (rtos (nth 0 ITEM) 2 2)
           YSTR (rtos (nth 1 ITEM) 2 2)
           ZSTR (rtos (nth 2 ITEM) 2 2)
           STR  (strcat XSTR (SPACES XSTR) YSTR (SPACES YSTR) ZSTR) ;_ strcat
     ) ; setq
;      (write-line STR F1)



(command "text" (list (+(atof xstr)(/ (atof httt) 2.0)) (cadr gptx)) httt "90" (strcat xstr))
(command "text" (list (+(atof xstr)(/ (atof httt) 2.0)) (cadr gpty)) httt "90" (strcat ystr))

  ) ; foreach

) ; write-vertices


(defun SPACES (STR / FIELD NUM CHAR SPACE)
  (setq FIELD 15
        NUM   (- FIELD (strlen STR))
        CHAR  " "
        SPACE ""
  ) ;_ setq
  (repeat NUM (setq SPACE (strcat SPACE CHAR))) ;_ repeat
) ;_ spaces

(defun C:prl () (SETTING) (VERTEXT) (RESETTING) (princ)) ; c:nsl

(prompt "\nwritten Azmat Ali 03317605164")
(prompt "\nCommand: PRL to Start ")



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