TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: jmcshane on November 04, 2010, 02:29:07 PM

Title: Civil 3D Structures and surfaces
Post by: jmcshane on November 04, 2010, 02:29:07 PM
Hi All,
For those of you out there who use Civil 3D, I am trying to assign a surface to all the structures in a pipe network.
Whenever I try and run the line highlighted in red I get an error: 
error: ActiveX Server returned an error: Type mismatch
I have a fair idea that someone is going to tell me the good news and inform me that its just not that simple,
so, my question is..........:
Is it possible to globally assign values to Civil 3D objects?
If it is possible, any chance of a hint?

Thanks in advance

John

Code: [Select]
(setq WorkingSurf (vlax-ename->vla-object (car (entsel "\nSelect Surface :"))))
(setq WorkingSurfaceName (vla-get-name WorkingSurf))
(if (> (setq SelectionSet (ssget "X" (list (cons 0  "AECC_STRUCTURE")))) Nil)
(progn
  (setq Objectctr 0)
(repeat (sslength SelectionSet)
(setq Item (ssname SelectionSet Objectctr))
(setq Item (vlax-ename->vla-object Item))
 
  [color=red](vlax-put-property Item 'Surface WorkingSurfaceName)[/color]

  (setq Objectctr (1+ Objectctr))
)
)
  )
Title: Re: Civil 3D Structures and surfaces
Post by: BlackBox on November 04, 2010, 03:35:00 PM
? ? ?

Code: [Select]
(vlax-property-available-p item 'surface T)

Edit: I do not have your software version, so I don't have the help file to look it up myself.
Title: Re: Civil 3D Structures and surfaces
Post by: Jeff_M on November 04, 2010, 05:48:36 PM
This is one of those areas where lisp falls flat on it's face with C3D. The Structure's Surface property is expecting you to pass it a Surface object, not the name, but even the object won't be good enough if it's a TinSurface because, well, a TinSurface does not match the requirement of a Surface (it should, but it doesn't) so this fails, too.

You CAN globally assign the Surface to all of the Structures, however, via either the Prospector or PipeNetwork Editor. Select the structures, right-click the Reference Surface column header and select the desired surface name.
Title: Re: Civil 3D Structures and surfaces
Post by: mjfarrell on November 04, 2010, 05:56:26 PM
I like the last part of the above as an option...


or


if you just want to do it as a program perhpas one could write the pipe files the you want to change out to a(n) XML file, edit that file, and reimport the pipe run
Title: Re: Civil 3D Structures and surfaces
Post by: Jeff_M on November 04, 2010, 06:14:11 PM
Or, write it in another language.....I'm almost positive this could be done in C# & VB.NET, possibly even VBA. It's just lisp has no real concept of OOP.
Title: Re: Civil 3D Structures and surfaces
Post by: jmcshane on November 09, 2010, 01:20:11 PM
Sorry for taking so long to get back to you. I've been swamped at work here this last few days.
Thank you all for your help, as well as learning something about lisp, you have saved me a load of time by not pursuing
something which couldn't be done.

Cheers

John