Author Topic: Schedules - Forulas - VB if then statement to check object is pipe HELP  (Read 10711 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: 4099
  • 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: 6151
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: 4099
  • 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: 6151
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)

Jeff H

  • Needs a day job
  • Posts: 6151
Just figured out how to do public links with dropbox
 and when you get it and it works let me know and I will remove it from mine since it is almost full

*******************************Edit**********************
Removed old file link
« Last Edit: May 19, 2011, 09:29:30 PM by Jeff H »

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
This is soo CLOSE...

I need to work out the lengths... they need to post in feet and inches

i.e.  120 = 10'-0"

Link to the current file is.....
http://dl.dropbox.com/u/20790817/testing04.dwg


thanks again Jeff
I am very  trainable....   (forgive my spelling)

Jeff H

  • Needs a day job
  • Posts: 6151
Quickest way and if just wanting to show in schedule.

---Select schedule
---Edit Style
---Select Length Column
---Modify
---Change Data Format

Jeff H

  • Needs a day job
  • Posts: 6151
Next step is to get Jeff_M away from Civil and into MEP so we would have someone to teach us VB and how to use MEP .NET API

Jeff_M

  • King Gator
  • Posts: 4099
  • C3D user & customizer
Now that is humorous and flattering :-) Although in my brief perusal of MEP (20 minutes or so) I'm seeing things I wish we had IN C3D. I'm leaving on a 2+ week vacation Sunday, perhaps I'll find some time to play around in the MEP world.

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
http://dl.dropbox.com/u/20790817/testing05.dwg

The point is to only have 3 columns
and the proper format for the length in the Description is feet and inches

i.e. 120 = 10'-0"

I have the extra columns because i'm trying to understand how it works, but I don't want those.

Need to get it into the description correctly.  I hope this is still possible.
I am very  trainable....   (forgive my spelling)

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
Seriously.. the more people in the MEP forum  the better...  feel like I'm swimming with weights...
I am very  trainable....   (forgive my spelling)

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
Unit Feet and inches does NOT seem to work either.. it seems to round to the nearest foot and does not include the marks ( ' ) or ( " )

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

DIW_CADtech

  • Bull Frog
  • Posts: 368
  • Push limits, embrace success, & discard failure.
I even tried to break out the feet inches and 1/16ths to seperate DataSetDefinitions from the [length] and then concatenate them in a DataSetDefinition [PIPELEN] 

I did have to use Chr(34) Chr(39) and Chr(47)  and it worked as a stand alone.. but once I introduced [PIPELEN] as a separate column... pthh... it went bust

So never got it to concatinate in the first place...

I'm bushed... calling it a night...
http://dl.dropbox.com/u/20790817/testing06.dwg    is the polished ver of 5

http://dl.dropbox.com/u/20790817/testing07.dwg    is my foolish attempt at using Chr()

take a look... or skip if you have a better idea and post that....

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