Property formula

Discussion in 'AutoCAD' started by Frank, Apr 6, 2005.

  1. Frank

    Frank Guest

    Is it possible to put a formula into a property that would be able to round
    the square footage up or down to the nearest whole number?
    ant help would be appreciated

    thanks
     
    Frank, Apr 6, 2005
    #1
  2. Frank

    Joe Sutphin Guest

    Use the Round function of Visual Basic.

    Round(120.5, 0) would return 120
    Round(121.5, 0) would return 122

    Both examples return the correct values. HTH ...

    Joe
     
    Joe Sutphin, Apr 6, 2005
    #2
  3. Frank

    Norman Yuan Guest

    Yes, of course. Example in following class module:

    Option Explicit

    Private mvarMyNumber As Double

    Public Property Let MyNumber(ByVal vData As Integer)
    mvarMyNumber = CDbl(vData)
    End Property

    Public Property Get MyNumber() As Integer
    MyNumber = CInt(mvarMyNumber) '''or other formula/function you want to
    use
    End Property

    Private Sub Class_Initialize()
    mvarMyNumber = 1.2345
    End Sub

    Public Sub Process()
    '' some processing that set/change mvarMyNumber's value
    End Sub

    Thus, a double number is used internally in the class as Double, while
    outside the class it can only be accessed as Integer. You can put whatever
    formula in Property Get procedure. You may not want to use Property Let to
    assign value to the double variable in certain situation in order to prevent
    accuracy loss, though.
     
    Norman Yuan, Apr 6, 2005
    #3
  4. Frank

    Frank Guest

    i need the rounded up square footage to be able it be extracted to a tag.

    The sq ft comes from the property set definition 'SpaceObjects' and the
    'NetFloorArea' property definition. I need this number to be a whole number
    (no Decimals) in the tag.

    sorry if i mislead you
     
    Frank, Apr 7, 2005
    #4
  5. Frank

    Oberer Guest

    frank, joe's suggestion didn't work?

    you're doing the following?
    -retrieving the blocks attributes
    -retrieveing the specific attribute to modify
    -using joe's suggestion to round your value
    -updating the block
     
    Oberer, Apr 7, 2005
    #5
  6. Frank

    Joe Sutphin Guest

    What doesn't work? An example please ...

    Joe
     
    Joe Sutphin, Apr 7, 2005
    #6
  7. Frank

    Frank Guest

    no it did not work

    what i did was to create a new space object formula as follows:

    round([NetFloorArea],0) I named this "Area (round)". I was then going to

    create a tag that would use this space definition. However when i add the

    property to the space and then check the property, it just shows

    "round([NetFloorArea],0)" in the property box.
     
    Frank, Apr 7, 2005
    #7
  8. Frank

    Oberer Guest

    Sorry Frank, I'm completely lost on this one. I was thinking you were using VBA code :)
    hopefully someone can help you with your space object formula??
     
    Oberer, Apr 7, 2005
    #8
  9. Frank

    Joe Sutphin Guest

    I don't follow. What is a ""space object?" I'm assuming you want to assign a
    value to an attribute tag in block definition?

    What are you referring to as the "property box"

    Joe
    --

     
    Joe Sutphin, Apr 7, 2005
    #9
  10. I think he's either trying to use Fields or props out of ADT.

    -- Mike
    ___________________________
    Mike Tuersley
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Apr 7, 2005
    #10
  11. Frank

    Joe Sutphin Guest

    So he wants to put a formula in a Property TextBox?

    I don't believe that will evaluate to anything. I can't imagine Autodesk
    creating such a thing but it would be an interesting concept.

    Joe
     
    Joe Sutphin, Apr 7, 2005
    #11
  12. What flavor of AutoCAD are you using ?
    And what version ?
     
    Jorge Jimenez, Apr 7, 2005
    #12
  13. Just a guess. I've seen a lot of them recently with people wanting to put
    formulae in fields. And, it definitely would be interesting!

    -- Mike
    ___________________________
    Mike Tuersley
    ___________________________
    the trick is to realize that there is no spoon...
     
    Mike Tuersley, Apr 8, 2005
    #13
  14. Frank

    Frank Guest

    Thanks for all the help. i figured it out. all i had to do was to create a
    new property data format with percision set to 0 and that solved my problem
     
    Frank, Apr 8, 2005
    #14
  15. Frank

    HJohn Guest

    Well, you figured out your problem but I still haven't figure out that where you trying to do. It would be great if you could give more detail on the problem so we could learn from it.
     
    HJohn, Apr 8, 2005
    #15
Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.