Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Help with Sum 2 Fields?

I have a circle & a rectangle object. I want to display the total length of these two objects.
In ACAD I use:
%<\AcExpr %<\AcObjProp Object(%<_ObjId 1477121296>%).Length>% + %<\AcObjProp Object(%<_ObjId 1477121616>%).Circumference>% >%
In BricsCAD I can use each field seperatly but can not get them to add values.
Any help is appreciated.

Comments

  • BricsCAD doesn't currently support formula fields.

    Regards,
    Jason Bourhill
    CAD Concepts

  • You can use fields to display dimensions of entities in a table, then use formulas to calculate the total length or other calculations.
    See sample in attachment.

    dwg
    dwg
    FormulasInTable.dwg
    24K
  • edited August 2017

    So only TABLEs support Formulas, not Mtext objects like Acad does.
    Too bad, as the TABLE is not desirable.
    So I select 15 objects & want to display the total length.
    It is a hidden formula in a Mtext object.
    Not so simple in a TABLE.

    Thanks fellas

  • I guess you would need to raise a support request to ask for this feature. I think this would require two actions, The ODA would need to add support for these objects, and Bricsys would need to create an interface for users to access.

    Attach a variation on Louis suggestion, where the table is hidden, and the contents of the total cell is linked to another field. To do this you need to select the nested cell in the field first, prior to running the FIELD command. When FIELD prompts you to select an object, you feed it the pre-selected entity.

    e.g.

    : (setq tableitem (car (nentsel "\nSelect Table item: ")))
    Select Table item: <Entity name: 2c02e8b0>
    : FIELD
    Select entity:!tableitem
    <Entity name: 2c02e8b0>
    

    Unfortunately BricsCAD also doesn't currently allow you to format the contents of a cell, so you have no explicit control over the number of decimal places displayed in a result.

    If you are just working with a single field, then you can take advantage of conversion factors to do a simple calculation. Include an example in the revised drawing.

    Of course you could just roll your own. There is a really good post on this forum on getting going with VLAX-Curve... functions.
    :)

    It inspired me to create the attached lisp to sum lengths & areas of selected objects.

    Regards,
    Jason Bourhill
    CAD Concepts

    dwg
    dwg
    FormulasInTable-LinkedtoField.dwg
    25K
    lsp
    lsp
    AddLength.lsp
    5K
  • Opened the DWG but the objects are not associated with the fields.
    Resizing the objects did not change the field values.

  • When the value for a field changes, it requires a REGEN to update the fields.

    -joe

  • Thanks, Joe that was the issue.
    Looks like it takes a "REGENALL" to get it to update & RegenAuto do not work for that.

  • @Charles Alan Butler said:
    I'll take a look tomorrow but FYI http://lee-mac.com/lengthfield.html

    This LISP won't currently work correctly for BricsCAD users for the same reason as your original post. Off topic really, but it uses an object property & field based approach, it also is limited to the type of objects it will report on. For example, I don't think you could get it to include the length of splines, as splines don't have this property. The Addlength.lsp I attached in my earlier post will give the length of any object that has this fundamental property.

    What I mean by the above is that through adversity BricsCAD forces you to rethink your approach on things, and being challenged like this isn't necessarily a bad thing.

    Regards,
    Jason Bourhill
    CAD Concepts

  • edited August 2017

    Fields can also display Lisp variables and it is relatively easy to create and update a (global) variable that contains the sum length of a selection set. This approach would be the workaround I would choose. See here.

    BTW: When I had this idea I thought it was quite original, but since then I have found similar examples on the WWW.

    @Jason Bourhill:
    In BC we have the vle-curve-getperimeter function.

  • Thanks Roy, I'll have a look.

  • @Jason Bourhill said:
    BricsCAD doesn't currently support formula fields.

    Regards,
    Jason Bourhill
    CAD Concepts

    oops thats a problem ;-((
    I´m very used to it, its a very important tool I use in Autocad, as an architect, its crucial for calculating all the surfaces in rooms, subtracting columns, adding together rooms to get the surface of the apartments, calculating all the apartments and get the building surface......etc.
    and even just small calculations (inclination of ramps), all the levels displayed ;-((( I´m using nearly for everything formulas fields....

    I hope this will be updated soon!

    @Roy Klein Gebbinck said:
    Fields can also display Lisp variables and it is relatively easy to create and update a (global) variable that contains the sum length of a selection set. This approach would be the workaround I would choose. See here.

    BTW: When I had this idea I thought it was quite original, but since then I have found similar examples on the WWW.

    @Jason Bourhill:
    In BC we have the vle-curve-getperimeter function.

    Hi Roy, I just took a quick look, but "i can understand some basics" it looks like something I have to take time to get it.
    do I have to rewrite the lisp every time I want to use it for different functions? if I pick more objects to get the information i need (perimeter, area, length) to make a calculation?

    so its just a tiny function I have in Autocad but it makes a BIG difference to have it.

    Franz

  • @fs_at12: Maybe BricsCAD V18, which will probably be released pretty soon, will have this functionality. We'll have to wait and see.

    Regarding my Lisp code:
    You would have to write or change some code to fit your specific needs. But if there is some level of standardisation in your CAD work you will be able to use it again and again. One of the advantages of this method is that you can use these variables in fields before there are any entities in model space. The fields can therefore already be present in templates. Which can be a big time-saver.

    I am attaching a new version of the "Field_Lisp_Variables" code. I have added two 'Total Area' examples.

    zip
    zip
    Field_Lisp_Variables_20170921.zip
    3K
This discussion has been closed.
Origami
Origami is the Japanese word for paper folding. ORI means to fold and KAMI means paper and involves the creation of paper forms usually entirely by folding.

Powered by VanillaForums, Designed by Steam