Author Topic: Schedules - Forulas - VB if then statement to check object is pipe HELP  (Read 5790 times)

0 Members and 1 Guest are viewing this topic.

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
It's been 13 years since i've done any VB... and mixing with AutoCAD isn't making it easier...

So here's what i'm trying to do...
I am trying to create a Bill of Materials schedule that lists everything in the 3d model...
3 coluns..
MK#  (reference line item number to bid sheet)(this is hand typed no automation here)
Quantity (simple quantity)
Description (posting the style of the object)

However,  the correct output for the DESCRIPTION objects would be  [cutlength][style][gaged] or [nom length][style] or if it's not pipe(i.e. has no cutlength) just [style]

To acomplish this....
I wanted to create an if then statement in the schedule in a formula column and or dataset formula type that first tests if the item is a pipe.

I can view the Extended Data of any object with the PropertySetDefininition attached and i see "?" for any item that is not a pipe

So I tried and if then statement to check fro "?" it   rusult was the whole code posted as text.. so fail
So I tried IsNumaric( [length] )=True rusult was the same as above
So i tried [length]=Nothing ... same as above
So i tried IsNul ( [length] ) = True ... code seemed to work however all items posted as having values.. which is false  fittings should have failed
So I tried [length]=Empty... posted code

I need to get this first check to work before i can use and if then or else statement to post the correct of 3 concatenated strings.
So essentially this is a check on the variable/property [length] or [cutlength]  

need some help  
Any suggestions?
Is there another way?  A better way?

Help.
I am very  trainable....   (forgive my spelling)

Jeff_M

  • King Gator
  • Posts: 3944
  • C3D user & customizer
Dumb question, what product is this for?

Possible more dumb questions to follow....

OK, I now see that you seem to be a one man posting crew in the ABS forum :-) So I think this must be for MEP? I'm not familiar with MEP, yet, but I'll have a look as soon as I can.
« Last Edit: May 18, 2011, 11:18:19 PM by Jeff_M »

Jeff H

  • Needs a day job
  • Posts: 6043
I am pretty sure he is talking about the VB script editor in Style manager..... MEP, ARCH etc..........

Load up drawing with info, but I think what you want would not be too difficult

« Last Edit: May 18, 2011, 11:49:14 PM by Jeff H »

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
Yes,
This is how I started.. see the following code... I thought I was really onto something then  it failed... see following picture... all items that do not begin with 110  are fittings/accesories/valves or other items that do not have [cutlength]  thus they get populated differently... so this check fails to deliver desired results.
I am very  trainable....   (forgive my spelling)

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
The desired end result is concatonating the appropriet data into different datasetdefinitions and posting those as a result

i.e.
Result = [NomStyle]
Result = [GuagedStyle]
or
Result = [Style]

If [length] = 217.5 Then
     Result = [NomStyle]
ElseIf [length] < 217.5 Then
     Result = [GuagedStyle]
Else
     Result = [Style]
endif

However... the previous code posted above fails on non pipe items... so need a different check on [length]
i have tried
IsEmpty
IsNumaric
 []=Nothing
IsNul

and have similar results.. seems to work on the pipe, but on the other items.. it ether posts the "NOminal" or "Guaged" statement... or it posts the full code in the cell.
I am very  trainable....   (forgive my spelling)

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
see attached autocad MEP 2012 file....
I am very  trainable....   (forgive my spelling)

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
Noticed the file doesn't post for those not logged in....
http://dl.dropbox.com/u/20790817/testing.dwg
I am very  trainable....   (forgive my spelling)

Jeff_M

  • King Gator
  • Posts: 3944
  • C3D user & customizer
So is this what you are looking for?

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
YESS.... what is different?
I am very  trainable....   (forgive my spelling)

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
JEFF M your my HERO!
I am very  trainable....   (forgive my spelling)

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
OK.. now I can't get the concatination to work...

For "Post Style"  I want to post just the [Style] variable

For "Nominal"  I want to post "Nominal 18' X " & [Style]
example output Nominal 18' X 12 INCH DI MECH JOINT-TYTON JOINT CEMENT MORTAR LINED ASPHALT COATED

For "Guaged" I want to post "FC " & [CLSTRING] & " " & [Style] & " (Guaged)"



So with that goal in minde I created a formula based DataSetDefinition for [Style2] and [Style3]
 
[Style2]
RESULT = "18' Nominal " & [Style]

[Style3]
RESULT = "FC " & [CLSTRING] & " " & [Style] & " (GUAGED)"

I think that [Style3] is the problem but no easy way to debug... 
or maybe I'm going at this the entirely wrong way?
Should I just include these concatonations inside of the results in the [LengthCheck] DataSetDefinition?

File
http://dl.dropbox.com/u/20790817/testing02.dwg

see also image attached.
I am very  trainable....   (forgive my spelling)

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
So I also tried modifying the [LengthCheck]

Same same... it doesn't work correctly..

http://dl.dropbox.com/u/20790817/testing03.dwg

Maybe i'm using RESULT =  incorrectly?
I am very  trainable....   (forgive my spelling)

Jeff H

  • Needs a day job
  • Posts: 6043
The title is still wrong but is this what you are looking for?


Had to delete one object and double click in bottom left window

Had to place parentheses correctly in Style2 and style3 and other function

If what you are looking for since drawing is 3MB and I have dropbox can I load it up to your dropbox

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
Yes, but not sure how to help you do that.. I'm new to DropBox  Not sure how to facilitate that.. waht do you need from me?  and it needs to be a different file name since it's posted in the forum.. don't want to confuse the crap out of people....
I am very  trainable....   (forgive my spelling)

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
you can also post it here and i can put it in my dropbox and paist the link in the forum

https://waterworks.hdsupply.com/fileshare/

just let me know.. it will evaporate after 24 hours.
I am very  trainable....   (forgive my spelling)