Jump to content

Recommended Posts

Posted

Hi, I was trying to do something like this:

 

(setq dimension (getstring "\nType the value: "))

(setq pt1...

(setq pt2...

(setq old_dimpost (getvar "dimpost"))

(setvar "dimpost" (rtos dimension))

(command "._dimlinear" pt1 pt2)

(setvar "dimpost" old_dimpost)

 

The problem is that the program still shows the original value of the dimension. As the dimpost variable is only supposed to be used to edit prefixes and sufixes it makes sence not to be able to edit the dimension.

Is there a variable that I can edit so I don't have the real dimension but the typed one?

Thanks

Posted

Something like this?

 

(defun c:dimov (/ dEnt tStr)
 (if (and (setq dEnt (car (entsel "\nSelect Dimension: ")))
          (eq "DIMENSION" (cdadr (entget dEnt)))
          (setq tStr (getstring t "\nType New Value: ")))
   (vla-put-TextOverride
     (vlax-ename->vla-object dEnt) tStr))
 (princ))

Posted

I don't think is exatcly this and because I don't know how to use the vla functions in lisp, but what I was trying to do is to get the dimension between two points and the dimension would already be done by the porgram. I don't know if I'm being clear... The problem really is that I don't know how I would aply this code showed in my program.

Posted

DIMPOST only inputs a prefix or suffix.. perhaps that could be the problem? The dimension will have whatever it measures, as is the default. Your code seems to be putting a number onto the end of it. Try typing in a few 1's when you run your code, the dimension should clearly have those 1's appended to it.

 

Further, your code is putting a string into (rtos), whereas (rtos) is looking to turn a real into a string. That function shouldn't even -work-. Try using (getreal)?

 

Hope some of that helps. ^^

Posted

Run this see if it fits your needs. dimlinear requires 3 points... atleast in 2008

 

(defun c:dimov (/ dEnt tStr)
 (setq pt1 (getpoint "Specify first extension line origin: "))
 (setq pt2 (getpoint "Specify second extension line origin: "))
 (setq pt3 (getpoint "Specify dimension line location: "))
 (command "dimlinear" pt1 pt2 pt3)  
 (if (and (setq dEnt (entlast))
          (eq "DIMENSION" (cdadr (entget dEnt)))
          (setq tStr (getstring t "\nType New Value: ")))
   (vla-put-TextOverride
     (vlax-ename->vla-object dEnt) tStr))
 (princ))

 

Also freerefill... get back to work... lol

Posted
Run this see if it fits your needs. dimlinear requires 3 points... atleast in 2008

 

(defun c:dimov (/ dEnt tStr)
 (setq pt1 (getpoint "Specify first extension line origin: "))
 (setq pt2 (getpoint "Specify second extension line origin: "))
 (setq pt3 (getpoint "Specify dimension line location: "))
 (command "dimlinear" pt1 pt2 pt3)  
 (if (and (setq dEnt (entlast))
          (eq "DIMENSION" (cdadr (entget dEnt)))
          (setq tStr (getstring t "\nType New Value: ")))
   (vla-put-TextOverride
     (vlax-ename->vla-object dEnt) tStr))
 (princ))

Also freerefill... get back to work... lol

 

Funny how you tell ME to get back to work when I simply wrote up a few suggestions and you took the time to analyze and edit his code.

 

YOU get back to work.

 

.... BLADOW!!

Posted

 

YOU get back to work.

 

 

I'm your boss for the next 3 minutes... lol

Posted

Yes, that's the porblem, dimpost only adds prefixes and suffixes. The rtos works, but it does what you said, the code puts the number which is in dimension right after the real measure. What I would have to do is to find out how to "erase" the real value and keep only the alternate value. This would be very easy to do in AutoCAD, but it's been a big problem lately in Lisp :-)

Posted

I've put it into my code and it worked! But the user still has to type the value. In my case, this value would still be predefined at the beginning of the code. Is there a way to use it?

Posted

Sorry people, problem solved! Thanks for the help

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