Author Topic: ACAD2000 - 2002 users?  (Read 3206 times)

0 Members and 1 Guest are viewing this topic.

daron

  • Guest
ACAD2000 - 2002 users?
« on: January 06, 2004, 05:28:32 PM »
I have a routine that I wrote using 2004. I sent the file along to a machine using 2002. One of the functions is looking for length and area properties in a nested or non-nested closed polyline. On my machine it finds both and everything's great, but on the 2002 machine it acts like a polyline doesn't have a length. I assume on any version there should be a length property to a pline. Here is the code, can any 2002 users replicate this problem:
Code: [Select]
(defun len-area (/ vl-obj)
     (cond ((setq nent (nentsel "\nSelect Object to check "))
   (setq vl-obj (vlax-ename->vla-object (car nent)))
   (cond ((and (= (vlax-curve-getEndParam vl-obj) 1.0)
(vlax-property-available-p vl-obj 'length)
  )
  (setq pipe-len (vla-get-length vl-obj)
len-ft  (strcat (rtos (/ pipe-len 12) 2 0)
 "'"
 )
  )
 )
 ((> (vlax-curve-getEndParam vl-obj) 1.0)
  (if (vlax-property-available-p vl-obj 'length)
(setq pipe-len (vla-get-length vl-obj)
     len-ft   (strcat (rtos (/ pipe-len 12) 2 0)
      "'"
      )
)
  )
  (if (vlax-property-available-p vl-obj 'area)
(setq pipe-area (vla-get-area vl-obj)
     area-ft (strcat (rtos (/ pipe-area 144) 2 0)
"'"
)
)
  )
 )
   )
  )
     )
)

Yes, I wrote this the day I read Stig's tutorial on curve's. Who knew I'd need it so quick.

Sorry, the other code was not tested right. This one should do better.

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
ACAD2000 - 2002 users?
« Reply #1 on: January 06, 2004, 06:48:45 PM »
Yes

AcadLWPolyline AcadPolyline have a length property that was not available in versions of the Object Model prior to AC2004 .. so VBA is affected too.

kwb
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

--> Donate to theSwamp<--

SMadsen

  • Guest
ACAD2000 - 2002 users?
« Reply #2 on: January 07, 2004, 04:33:20 AM »
Daron, how come you don't use vlax-curve-getdistatparam to get the length? That'll work in 2000 and after.

daron

  • Guest
ACAD2000 - 2002 users?
« Reply #3 on: January 07, 2004, 09:37:55 AM »
Did you explain that one? I'm too new with those. They suited the purpose I saw them for, but if the getdistatparam is my workaround, then I'll use it. Thanks for the thought. Kerry, thanks for letting me know that nothing was wrong with the other machines.

SMadsen

  • Guest
ACAD2000 - 2002 users?
« Reply #4 on: January 07, 2004, 10:32:34 AM »
Watch out for the follow-up in relaxed-curves  :)

Hopefully posting it this evening

daron

  • Guest
ACAD2000 - 2002 users?
« Reply #5 on: January 07, 2004, 10:33:18 AM »
Well, here is the end-result. Thanks Stig.
Code: [Select]
;;;arguments = any string element i.e. "'".
(defun len-area (str-callout / vl-obj)
     (cond ((setq nent (nentsel "\nSelect Object to check "))
   (setq vl-obj      (vlax-ename->vla-object (car nent))
 int-pts     (vlax-curve-getEndParam vl-obj)
 bool-closed (vlax-curve-IsClosed vl-obj)
 pipe-len    (vlax-curve-getDistAtParam vl-obj int-pts)
 len-ft      (strcat (rtos (/ pipe-len 12) 2 0)
     str-callout
     )
   )
   (cond (bool-closed
  (setq pipe-area (vlax-curve-GetArea vl-obj)
area-ft   (strcat (rtos (/ pipe-area 144) 2 0)
  str-callout
  )
  )
 )
   )
  )
     )
)

daron

  • Guest
ACAD2000 - 2002 users?
« Reply #6 on: January 07, 2004, 10:44:20 AM »
OBTW, I am looking forward to the next installment. In the mean time:

Dent Cermak

  • Needs a day job
  • Posts: 6914
  • Clinton, Mississippi
ACAD2000 - 2002 users?
« Reply #7 on: January 07, 2004, 01:07:03 PM »
I HAVE DEVELOPED A NEW RATING SYSTEM THAT IS MORE ACCURATE.
I RATE THIS ONE AS:











This icon comes with the AutoCad Electrical pac. It's the "Laying Cable" command.
If you are looking to me for answers, you really have problems. Carlson Survey 2016 w/ Embedded AutoCad