TheSwamp

Code Red => AutoLISP (Vanilla / Visual) => Topic started by: Peter2 on July 27, 2017, 07:30:24 AM

Title: retrieve the names of Civil-surfaces from database
Post by: Peter2 on July 27, 2017, 07:30:24 AM
The following code works fine to get a list of Alignments and Profile-groups. But I tried to modify it for surfaces - and now I get a "type conflict", asking for ITEM:

Code: [Select]
    (setq surfaces (vlax-get C3DDOC 'surfaces))
    (setq surf_max (vlax-get-property surfaces "Count"))
    (setq surf_counter 0)
    (while (< surf_counter surf_max)
        (setq surf_temp (vlax-invoke-method surfaces "Item" surf_counter))
        (setq surf_counter (+ surf_counter 1))
    )

Code: [Select]
Befehl: (setq ACADPROD (strcat "AeccXUiLand.AeccApplication." C3DVER))
"AeccXUiLand.AeccApplication.12.0"

Befehl: (setq *acad* (vlax-get-acad-object))
#<VLA-OBJECT IAcadApplication 00007ff73b0a5188>

Befehl: (setq C3DOBJECT (vla-getinterfaceobject *acad* ACADPROD))
#<VLA-OBJECT IAeccApplication 000001a6b32dbea0>

Befehl: (setq C3DDOC (vla-get-activedocument C3DOBJECT))
#<VLA-OBJECT IAeccDocument 000001a6b8b03c10>

Befehl: (setq surfaces (vlax-get C3DDOC 'surfaces))
#<VLA-OBJECT IAeccSurfaces 000001a69adfaca8>

Befehl: (setq surf_max (vlax-get-property surfaces "Count"))
2

Befehl: (setq surf_counter 0)
0

Befehl: (setq surf_temp (vlax-invoke-method surfaces "Item" surf_counter))
; Fehler: ActiveX-Server hat einen Fehler zurückgegeben: Typenkonflikt

I found some snippets to collect the surfaces, but they are using "SSGET" instead of "vlax-". What's wrong with it?
Title: Re: retrieve the names of Civil-surfaces from database
Post by: huiz on July 27, 2017, 07:33:58 AM
Maybe you must specify if you want TinSurface, GridSurface, TinVolumeSurface or GridVolumeSurface objects.

Or it conflicts with the AutoCAD Surface object.
Title: Re: retrieve the names of Civil-surfaces from database
Post by: Peter2 on August 02, 2017, 12:18:54 PM
I could solve it with a small lisp from here

http://cadtips.cadalyst.com/lisp-code-modules/detect-civil-3d-surfaces

But I don't know the background of the difference ..
Title: Re: retrieve the names of Civil-surfaces from database
Post by: Jeff_M on August 02, 2017, 12:29:38 PM
Vlisp and C3D objects are quirky. I've found that using (vlax-for on the C3D collections will almost always work, whereas the Item method is a hit & miss.
Title: Re: retrieve the names of Civil-surfaces from database
Post by: ronjonp on August 02, 2017, 12:32:54 PM
HERE's (http://www.cadtutor.net/forum/showthread.php?101128-Finding-Local-Depressions-in-Surface&p=687329&viewfull=1#post687329) a thread that may help shed some light too.
Title: Re: retrieve the names of Civil-surfaces from database
Post by: BIGAL on August 08, 2017, 07:09:03 AM
I developed a routine whereby you can change the surfaces using a toolbar rather than toolspace, you can turn on/off etc as many as required. Its all in the ZIP there is a doc fileabout how to modify. So much easier than using toolspace. Its all done with lisp so open code.
Title: Re: retrieve the names of Civil-surfaces from database
Post by: Peter2 on August 08, 2017, 09:01:44 AM
Thanks BIGAL

I will take a look.