Ad

Monday, May 26, 2008

VBA Pipe To Inside Edges

Some people want the invert of a pipe labeled at the inside edge of a structure. I placed a vba routine on the Intermittent Block or Style Of The Day (05-26-08 date) that moves the pipe from the center of the structure to the inside edge so you don't have to do it manually (if that's what you currently do). This could be added to a pipe rule so it could be done at the time rules are applied. The pipes will go back to the center of the structure if the structure is moved or the rotation changed, in that case you would have to reperform the routine. It currently only does on pipe at a time, but could be modified to do all of the pipes in a drawing or all pipes attached to a structure. The program should only work in 2008, but the references could be updated for 2009 or a previous version. I don't have access to a copy of 2009, so I can't currently update it for the current version.

As a reminder to myself, this is what I learned doing this:

  • AngleFromXAxis allows you to get the angle of two points in Autocad rather easily.
  • PolarPoint allows you to enter a starting point, angle and distance to easily find a point along a line.
  • IntersectWith allows you to take an object in Autocad and see if another object intersects with it. This would have been handy to know when I did my laterals program (may also be found on the Intermittent Block or Style Of The Day site). You can see if they naturally intersect or extend either or both objects to see if they intersect.
  • There is no good way to find if 2 sets of 2 points intersect from the resulting two lines. You either have to enter the formulas or create temporary lines and see if they intersect.

3 comments:

Anonymous said...

Hi Christopher,
I tried to use this
VBA for one of my project to make pipes inside the structure move to inside edge but it doesn't work.
I tried to find refrence but
still I have problem.
It says
"you didn't choose tructure"
when I choose a structure.
Regards
mpaydari@yahoo.com

Jeff Lyons said...

I Fixed the VBA:
* added AEC Base / Object References
* added common function to publicly declare the Pipe Application, Document and Database priot to entering the sub routine

jlyons@landproject.com
www.civil3dsolutions.com

Jeff Lyons said...

Fixed VBA by:
* adding AEC Base and Object references
* setting the public AECC Pipe Application, Document and Database objects prior to running the routine

--Jeff
jlyons@landproject.com

LinkWithin

Blog Widget by LinkWithin