Charlesv Posted January 17, 2013 Posted January 17, 2013 Hi, This is my very first post hope everyone is doing well. Anyway Im trying to use a variable within the dimpost command. This works fine as is...but no variable yet...just a prefix to the dimension. (command "dimpost" "SPACES @ 16\u+0022 = ") This is what I would like to do... (command "dimpost" "VAR1 SPACES @ 16\u+0022 = ") VAR1 is the variable that I would like to show...not sure how to do the syntax. Any help would be much appreciated... Thanks Quote
pBe Posted January 17, 2013 Posted January 17, 2013 (edited) Welcome to CAD Tutor charlesV Look into strcat function Edited January 17, 2013 by pBe Quote
Tharwat Posted January 17, 2013 Posted January 17, 2013 You should have the variable VAR1 as string . (strcat VAR1 "SPACES @ 16\u+0022 = <>") Quote
pBe Posted January 17, 2013 Posted January 17, 2013 Oops , pBe beat me to it ... I only wanted to welcome the "new guy" to our wonderful forum. You can expand your post and show more examples, that will be a nice welcome for CharlesV. Cheers Quote
Charlesv Posted January 17, 2013 Author Posted January 17, 2013 Thanks for the welcome guys and your quick replies! So I need to create a new variable say VAR2 which will make VAR1 a string? If so what would the code look like? Not sure how to make VAR1 a string. so the code for my dimpost command would look like... (command "dimpost" (strcat VAR2 "SPACES @ 16\u+0022 = ") Quote
Tharwat Posted January 17, 2013 Posted January 17, 2013 What is the value of the Var1 ? And what is the use of the var2 you looking for ? Quote
Charlesv Posted January 17, 2013 Author Posted January 17, 2013 VAR1 will change depending on user input. As for VAR2 I dont need it....just thought I would have to create a new variable which converted VAR1 to a string for use in my dimpost code. Quote
Tharwat Posted January 17, 2013 Posted January 17, 2013 (edited) Check this simple routine ... (defun c:var (/ var) (if (/= "" (setq var (getstring t "\n Enter string to be assigned to a prefix :") ) ) (setvar 'dimpost (strcat var " SPACES @ 16\u+0022 = <>")) ) (princ) ) Edited January 17, 2013 by Tharwat a little bit extra codes removed Quote
Lee Mac Posted January 17, 2013 Posted January 17, 2013 (/= var nil) getstring will not return nil Quote
Tharwat Posted January 17, 2013 Posted January 17, 2013 getstring will not return nil Oh correct , Thanks a lot . Quote
Charlesv Posted January 17, 2013 Author Posted January 17, 2013 Is there anyway to avoid asking for additional user input? The dimpost variable is changed just before placing the dimension then back to normal after the dimension is placed. Was hoping to just add the VAR1 to it. Quote
Charlesv Posted January 18, 2013 Author Posted January 18, 2013 I appreciate the help guys!! After looking at what you guys were suggesting I ended up with this... (command "dimpost" (strcat (rtos var1 5 0) " SPACES @ 16\u+0022 = ")) B E A U T I F U L I've been trying to get this to work for a while now...thanks to you guys its done!! Thank you very much!! Quote
Recommended Posts
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.