Use a factor for a field?

I want to use a factor for a field.
Example: drawing units represent millimetres, but an area value should be expressed in square metres.
This does not seem possible at the moment. Does anybody know of a work-around?

Comments


  • Hello Roy,
    I ran into this problem some time ago. This is an excerpt from the SR:

    Question:
    2012-06-13 15:55 UTC
    I need a field to display the area of hatches in sqm, while the drawing uses centimeters as units.
    I read somewhere in the autodesk docs that you could apply a conversion factor to fields, but couldn't find this on V11. Is this possible somehow, in V11 or V12?
    2012-06-14 13:39 UTC
    to circumvent the broken field dialog, I tried to enter the field code manually - but this did not work, neither in the internal mtext editor, nor in an external one - the input is simply not parsed.
    So, before I waste more time on this, the question would rather be: is there a way to insert the field codes (including a conversion factor) and have them evaluated through the LISP API?

    Answer:
    2012-06-16 09:10 UTC
    Indeed, in Autocad can be applied a conversion factor to the fields. For the moment this cannot be done in Bricscad. I will ask about this implementation and I will update you.
    2012-06-27 11:06 UTC
    We have no short term plans for implement an Additional Format option in Field dialog window.
    This has been added as Feature Request and I will keep you updated about it.

    The SR is still open...
    If you find a way around this, please post back!
  • OK, here is a workaround.
    - Only works on fields that are unformatted.
    - The decimal format is hard-coded.
    - There is a strange bug in BC13.1.18 when using (entmod) on a field. If this bug gets fixed in a future version the code will no longer work.

    FormatFields.lsp

  • Perfect - thanks a lot for sharing!
    The script runs fine on linux, too. I just replaced the getstrings for precision and factor by getvars (misused DIMALTD and DIMALTF), and that's it for my needs.
    Only problem is that I can't seem to get undo to work properly - but I still have to take a closer look.
    Do I understand you right that you cannot work on already formatted fields, because it is currently impossible to overwrite the format string via entmod?
  • Do I understand you right that you cannot work on already formatted fields, because it is currently impossible to overwrite the format string via entmod?
    Yes. Somehow you can only add to the existing string. I will try to look into the undo problem. But this may stay tricky.
  • Hi Roy,
    I think the undo problem is mostly cosmetic:
    If you format a field, then regen, then undo until the format string is removed, the now non-existing format gets reapplied with the next regen, and survives even updatefield. But reopening the drawing clears this, so for me, it's not a show stopper.
    The entmod glitch is a little more embarassing, but at least, the formatting can be deleted via the gui...
  • I have added a solution for the UNDO problem. The function now copies the selected entity, deletes the entity and applies the format string to the new entity. This solution falls into the if-you-can't-make-it-fake-it category, but the result is a 'correct' UNDO-REDO sequence. Of course the fact that a new entity is created can be problematic in cases where the draworder is important.

    FormatFields_20130212.lsp

This discussion has been closed.