Author Topic: Elevations on Worksheets  (Read 14224 times)

0 Members and 1 Guest are viewing this topic.

Offline jmerchTopic starter

  • Premier Member
  • *****
  • Posts: 2297
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #15 on: Nov 09, 2012, 17:20:37 PM »
in custom data fields?
Intel i7-6700K @ 4 GHz - 32GB RAM - NVidia Quadro M5000 - W10x64 - MEP & FABRICATION 2014/2017 - NAVIS 2017 - REVIT 2017.1

Offline DonWunder

  • Senior Member
  • ****
  • Posts: 276
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #16 on: Nov 09, 2012, 17:27:21 PM »
Make a custom data field and product list that.
Don Wunderlich
The Hill Group

Offline jmerchTopic starter

  • Premier Member
  • *****
  • Posts: 2297
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #17 on: Nov 09, 2012, 17:28:32 PM »
Ah. k.  boy, what a lot of work.  If only they'd just add this to the available Worksheets data fields as requested by many users many times. :D

Thanks Don.  I'll play around with it.
Intel i7-6700K @ 4 GHz - 32GB RAM - NVidia Quadro M5000 - W10x64 - MEP & FABRICATION 2014/2017 - NAVIS 2017 - REVIT 2017.1

Offline cam-nav

  • Premier Member
  • *****
  • Posts: 4077
  • Country: us
  • Gender: Male
    • McKinstry.com
Re: Elevations on Worksheets
« Reply #18 on: Nov 09, 2012, 18:18:49 PM »
Code: [Select]
item.endlocation(1,"btm")
gets the bottom elevation of end 1..
Dave

Offline jmerchTopic starter

  • Premier Member
  • *****
  • Posts: 2297
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #19 on: Nov 09, 2012, 18:31:18 PM »
BAM! You da man!

Now, is there any way in scripting to have it convert that number to a fraction instead of decimal?  Or am I pushing it? :) Right now it would spit out 4.81 where I would want it to say 4 7/8" or whatever.  Since it's going in a custom data field which doesn't have many options.  And there's no Calculated Field in worksheets either.

If not, we can live with the decimal.
Intel i7-6700K @ 4 GHz - 32GB RAM - NVidia Quadro M5000 - W10x64 - MEP & FABRICATION 2014/2017 - NAVIS 2017 - REVIT 2017.1

Offline DonWunder

  • Senior Member
  • ****
  • Posts: 276
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #20 on: Nov 09, 2012, 18:55:59 PM »
You can use a if statement for decimal values between certain precisions to output a fraction.

Example:
You need to find the decimal part of the number with round down functions. Then use the below code for each fraction precision.

Code: [Select]
if (Value1>= .0625 and Value1 < .1875) then
  fraction = "1/8"
endif
Don Wunderlich
The Hill Group

Offline jmerchTopic starter

  • Premier Member
  • *****
  • Posts: 2297
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #21 on: Nov 09, 2012, 19:03:34 PM »
ok. Thanks.
Intel i7-6700K @ 4 GHz - 32GB RAM - NVidia Quadro M5000 - W10x64 - MEP & FABRICATION 2014/2017 - NAVIS 2017 - REVIT 2017.1

Offline cam-nav

  • Premier Member
  • *****
  • Posts: 4077
  • Country: us
  • Gender: Male
    • McKinstry.com
Re: Elevations on Worksheets
« Reply #22 on: Nov 09, 2012, 20:33:01 PM »
You can find the decimal part this way. Dim the original prefix getinch, then re-add it to the string.

Code: [Select]
dim sBtm = item.endlocation(1,"Btm")
dim pt = instr(1,sBtm,".")
dim getfrac = right(sBtm,(len-pt))
dim getinch = left(sBtm,pt-1)

dim frac = other code here
dim BtmElev = getinch + " " + frac + quote

return BtmElev
Dave

Offline jmerchTopic starter

  • Premier Member
  • *****
  • Posts: 2297
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #23 on: Nov 09, 2012, 20:41:03 PM »
Will try it out, thanks!
Intel i7-6700K @ 4 GHz - 32GB RAM - NVidia Quadro M5000 - W10x64 - MEP & FABRICATION 2014/2017 - NAVIS 2017 - REVIT 2017.1

Offline jmerchTopic starter

  • Premier Member
  • *****
  • Posts: 2297
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #24 on: Nov 14, 2012, 21:40:31 PM »
Dave,
the code is erroring out on

Code: [Select]
right(sBtm,(len-pt))
Unknown variable "len"

Thoughts?
Intel i7-6700K @ 4 GHz - 32GB RAM - NVidia Quadro M5000 - W10x64 - MEP & FABRICATION 2014/2017 - NAVIS 2017 - REVIT 2017.1

Offline DonWunder

  • Senior Member
  • ****
  • Posts: 276
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #25 on: Nov 15, 2012, 13:14:06 PM »
Dave,
the code is erroring out on

right(sBtm,(len-pt))

Unknown variable "len"

Try the rounddown function.
Don Wunderlich
The Hill Group

Offline cam-nav

  • Premier Member
  • *****
  • Posts: 4077
  • Country: us
  • Gender: Male
    • McKinstry.com
Re: Elevations on Worksheets
« Reply #26 on: Nov 15, 2012, 18:01:44 PM »
You can find the decimal part this way. Dim the original prefix getinch, then re-add it to the string.

dim sBtm = item.endlocation(1,"Btm")
insert new dim from below
dim pt = instr(1,sBtm,".")
dim getfrac = right(sBtm,(len-pt))
dim getinch = left(sBtm,pt-1)

dim frac = other code here
dim BtmElev = getinch + " " + frac + quote

return BtmElev

add dim len = len(sBtm)

HAHA quoted myself, never done that before... :)
Dave

Offline jmerchTopic starter

  • Premier Member
  • *****
  • Posts: 2297
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #27 on: Nov 15, 2012, 20:58:12 PM »
for the "if" code from Don, does it need to be:

Code: [Select]
if (getfrac>= .1875 and getfrac < .3125) then
dim frac = "1/8"
endif

OR does it need to be
dim frac = if......

I'm not sure how to combine the variable set (frac) with the if statements.
Intel i7-6700K @ 4 GHz - 32GB RAM - NVidia Quadro M5000 - W10x64 - MEP & FABRICATION 2014/2017 - NAVIS 2017 - REVIT 2017.1

Offline cam-nav

  • Premier Member
  • *****
  • Posts: 4077
  • Country: us
  • Gender: Male
    • McKinstry.com
Re: Elevations on Worksheets
« Reply #28 on: Nov 15, 2012, 21:42:01 PM »
Do it this way.

Code: [Select]
dim sBtm = item.endlocation(1,"Btm")
dim len = len(sBtm)
dim pt = instr(1,sBtm,".")
dim getfrac = right(sBtm,(len-pt))
dim getinch = left(sBtm,pt-1)

dim frac

[b]if (getfrac>= .1875 and getfrac < .3125) then
frac = "1/8"
endif[/b]

dim BtmElev = getinch + " " + frac + quote

return BtmElev
Dave

Offline jmerchTopic starter

  • Premier Member
  • *****
  • Posts: 2297
  • Country: us
  • Gender: Male
Re: Elevations on Worksheets
« Reply #29 on: Nov 15, 2012, 22:08:01 PM »
k, so now what about multiple "if" statements to round to 1/4 and up?  I tried putting them all in under

Code: [Select]
dim frac
if......then 1/8
if.....then 1/4
endif
endif

I also tried individual if and that errored.

Thanks for putting up with this :)
Intel i7-6700K @ 4 GHz - 32GB RAM - NVidia Quadro M5000 - W10x64 - MEP & FABRICATION 2014/2017 - NAVIS 2017 - REVIT 2017.1