Dimesion & field & expression
Hello,
I have rotated dimension which measures e.g. 1 drawing unit, being multiplied by DIMLFAC it gives e.g. 1000.
I need to show this value incremented by 1, so that the dimension show "1001".
I am aware of fields at the place of the dimension text which allow to use Lisp vars, system vars, links to other objects and so on.
Here, I need to refer to itself (use its own measured value) and to modify it somehow (to add "+1").
Is there a way to achieve this?
Best regards,
Lukas
Comments
-
This is possible, however not easily done.
You would have to create an object reactor, that on each change of the dimension object would replace the text in the underlying anonymous block. Since I have written a reactor for my own use to reformat dimensions to German architectural standards, I could send you some code to get you started, but I am reluctant to put any effort into this, since the use case looks completely arcane to me...0 -
@Lukáš Procházka said:
Hello,
I have rotated dimension which measures e.g. 1 drawing unit, being multiplied by DIMLFAC it gives e.g. 1000.
I need to show this value incremented by 1, so that the dimension show "1001".
I am aware of fields at the place of the dimension text which allow to use Lisp vars, system vars, links to other objects and so on.
Here, I need to refer to itself (use its own measured value) and to modify it somehow (to add "+1").
Is there a way to achieve this?
Best regards,
LukasIt's a strange request. By nature the intention of CAD is to model things accurately. Not doing so usually leads to issue IMHO.
The closest way I could see to do this without programming would be to use a limit based dimension (DIMLIM = 1), then set the upper limit (DIMTP) to the increment that you want. However, this results in two numbers being displayed rather than one.
Regards,
Jason Bourhill
CAD Concepts0 -
The easiest way may be to just take advantage of the suffix field in dimension styles. Normally, they would be used, for things like adding "m" to meters units being displayed. But, you could simply put "+1" and let the user do the math when they read the dimension.
-Joe
0 -
@Knut Hohenberg said:
This is possible, however not easily done.
You would have to create an object reactor, that on each change of the dimension object would replace the text in the underlying anonymous block. Since I have written a reactor for my own use to reformat dimensions to German architectural standards, I could send you some code to get you started, but I am reluctant to put any effort into this, since the use case looks completely arcane to me...Hello Knut,
I would be very pleased if you share (a piece of) your code, at least to be inspired...
My mail add is: LPr at pontex dot cz.
Thanks you in advance.
Best regards,
Lukas0 -
Hello Lukas,
attached you'll find a script that might do what you try to achieve.
If you set up your dimensions as proposed by Jason, it can hide the lower tolerance limit by means of a reactor.
Contained are 3 commands:ATF (AttachToleranceFormat) attaches the reactor to selected dimensions that have limits display activated
RTF (RemoveToleranceFormat) removes the reactor from selected dimensions
STF (SelectToleranceFormat) selects dimensions that have the reactor attachedThe example drawing has some dimensions set up as needed, to play around with.
Note that the reactor will work only when the script is loaded; you might autoload it via appload, or put code like this in an autoloaded file (e.g. .mnl), provided the script is found in searchpath:
(foreach n (vlr-reactors :vlr-object-reactor) (if (= "KHAD:dimtolerancereactor" (vlr-data (cadr n))) (if (not (load "hide_lower_tolerance.lsp" nil)) (princ "Load Error:\nhide_lower_tolerance.lsp not found - dimension formatting reactor defunct") ) ) )
Keep in mind that this code has been quickly patched together and is almost completely untested, so all kind of bugs are to be expected.
0 -
@Lukáš Procházka said:
I need to show this value incremented by 1, so that the dimension show "1001".
If you go this route, be sure to do something to indicate that the dimensions are not the true length. Otherwise some future user of the DWG file is going to be very puzzled and may create some designs that are faulty, and potentially very expensive.
You could (and probably do already) have a note on every drawing. But, if some dimensions are true values, and others not, I suggest adding a phrase like, "Value has 1" extra" in small text above or below the dimension value. This way the CAD guy knows what values are actual lengths.
-Joe
0 -
Hello,
thanks all for replies and for sharing the code.
Of course, dims with altered text should be recognizable somehow...
Best regards,
Lukas0 -
As remarked initially, I cannot see the use case for this script, and just provided the code as a base for further tinkering.
You can quite easily add some formatting to the altered dimension texts, e.g. in the newly attached version they display in red (see lines 8-10).
0