Jump to content

Recommended Posts

Posted

What I am trying to accomplish would be two selection types: 1) what the default texts would be + a manual option and 2) where on the dimension the override to happen.

I seem not to be able to successfully select one of the options under  (initget "(Typ.) (TYpe.) (Plus-minus ±) Manual"): the manual is supposed to be for non default text.

 

Can someone let me know what is wrong with this?

 

image.png.45bcad1c26fc789729755828af276dc9.png

This was my result before attempting to add the first option (initget "(Typ.) (TYpe.) (Plus-minus ±) Manual").

 

Please help!

(defun c:dimch1 (/ Rtrn txt ss in vl)
  
(progn
           (princ "\nSelect Dimension to modify: ")
           (setq ss (ssget "_:L" '((0 . "DIMENSION"))))
         )

; START OF SELECTION FOR ADDING TEXT ON DIMENSIONS
(progn
           (initget "(Typ.) (TYpe.) (Plus-minus ±) Manual")
           (setq
             Rtrn (cond ((getkword
                           "\nType [(Typ.)/(TYpe.)/(Plus-minus ±)/Manual] <Manual>: "
                         )
                        )
                        ("Manual")
                  )
           )
         )


  ;(if
    ;(and (setq Manual (/= (setq txt (getstring t "\n Specify the Text string :"))
             ""
         ;))

(progn
       (cond
	 ((= Rtrn "(Typ.)") (setq Txt "(Typ.)"))
         ((= Rtrn "(TYpe.)") (setq Txt "(Type.)"))
         ((= Rtrn "(Plus-minus ±)") (setq Txt  "± "))
         ((= Rtrn "Manual") (setq Txt Txt))

	 	 
       ) ;end 2nd. condition
       (repeat (setq in (sslength ss))
         (setq vl (vlax-ename->vla-object (ssname ss (setq in (1- in)))))
         (vl-catch-all-apply 'vla-put-TextOverride (list vl txt))
       )
     )

; END OF SELECTION FOR ADDING TEXT ON DIMENSIONS
	 
         (progn
           (initget "Above Below Prefix Suffix")
           (setq
             Rtrn (cond ((getkword
                           "\nType [Above/Below/Prefix/Suffix] <Suffix>: "
                         )
                        )
                        ("Suffix")
                  )
           )
         ) ; end 1st. progn
         
    ;) ;end And
     (progn
       (cond
	 ;((= Rtrn "Above") (setq Txt (strcat Txt "\\P<>")))
         ;((= Rtrn "Below") (setq Txt (strcat "<>\\P" Txt)))
         ;((= Rtrn "Prefix") (setq Txt (strcat Txt " <>")))
         ;((= Rtrn "Suffix") (setq Txt (strcat "<> " Txt)))

	 ((= Rtrn "Above") (setq Txt (strcat "{\\fArial|b1|i0|c0|p34;" Txt "}" "\\P<>")))
         ((= Rtrn "Below") (setq Txt (strcat "<>\\P" "{\\fArial|b1|i0|c0|p34;" Txt "}"))) ; replace it with <>\X{\fArial|b0|i0|c0|p34;(Type)}
         ((= Rtrn "Prefix") (setq Txt (strcat "{\\fArial|b1|i0|c0|p34;" Txt "}" " <>")))
	 ((= Rtrn "Suffix") (setq Txt (strcat "<> " "{\\fArial|b1|i0|c0|p34;" Txt "}")))
	 
	 
       ) ;end 2nd. condition
       (repeat (setq in (sslength ss))
         (setq vl (vlax-ename->vla-object (ssname ss (setq in (1- in)))))
         (vl-catch-all-apply 'vla-put-TextOverride (list vl txt))
       )
     ) ;end 2nd. progn
  ;) ; end if
  (princ)
) ;End Defun

 

Posted

Could someone tell me what it is that I am missing to make this work please?

image.thumb.png.f68598a266f3df71d6931758b535c93e.pngimage.png.20a705ee34105e39920627501549e678.png

Posted (edited)

I think initget and getkword are well documented. What is stopping you from Reading The Manual?

Edited by Roy_043
Posted

not quite sure. With this second options I have given myself (Typ./TYpe/...) it just will not execute.

I just cannot see where I went wrong!

giphy.gif

Posted

Can you please stop posting these gifs? they are quite annoying.

Posted

I will stop them immediately! NO MORE GIF

Posted

This works in BricsCAD:

(initget "(Typ.) (tYpe.) (Plus-minus±) Manual")

 

1. Keywords should not share caps. So "tYpe" instead of "TYpe".

2. Keywords cannot contain spaces. So "Plus-minus±" instead of "Plus-minus ±".

 

But I would use:

(initget "T Y P M")

Posted

Thanks

I think my problem was the bloody space!

 

I will see what I can do!

 

Thanks Roy.

Posted

I just do not use initget look into downloads here.

 

(if (not AH:Butts)(load "Multi Radio buttons.lsp"))
(if (= but nil)(setq but 1))
(setq ans (ah:butts but "v"  '("Choose  " "Typ." "TYpe." "±" " Manual")))

image.png.4b76854d258be045eef6ae7778da837a.png

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