Dxf code to identify types of surfaces.

Dxf code to identify types of surfaces.

carlos_m_gil_p
Advocate Advocate
1,072 Views
6 Replies
Message 1 of 7

Dxf code to identify types of surfaces.

carlos_m_gil_p
Advocate
Advocate

Hello boys how are you.

 

With what code dxf can I identify if an entity is a surface (loft), surface (network) or surface (Nurbs)

 

What I want is.
Select a surface with entsel.
And tell me what kind of surface it is.
But with DXF codes, not VL

Excuse my English, I only speak Spanish.
Thanks for the help.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Accepted solutions (1)
1,073 Views
6 Replies
Replies (6)
Message 2 of 7

cadffm
Consultant
Consultant

look into the dxf definition of you object:

(entget(car(entsel)))

 

Befehl: (assoc 0 (entget (car(entsel))))

Objekt wählen: (0 . "LOFTEDSURFACE")

Befehl: (assoc 0 (entget (car(entsel))))

Objekt wählen: (0 . "NURBSURFACE")

Befehl: (assoc 0 (entget (car(entsel))))

Objekt wählen: (0 . "LOFTEDSURFACE")

Sebastian

0 Likes
Message 3 of 7

carlos_m_gil_p
Advocate
Advocate

@cadffm Hello how are you.

Thanks for answering.

 

Normally I do it like that.

But if you notice, the code of the surface (loft) and the surface (network) are the same.
And I do not know how I can identify which is which.

 

Thank you.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes
Message 4 of 7

cadffm
Consultant
Consultant

If you compare group-0 you will see that is not clear enough for Loft and Network Surface

command: (assoc 0 (entget (car(entsel))))

(0 . "LOFTEDSURFACE")

(0 . "NURBSURFACE")

(0 . "LOFTEDSURFACE")

 

So  compare the xdata (Groupcode -3) of the objects: (entget (car(entsel)) '("*"))


(0 . "LOFTEDSURFACE")
(-3 ("ACAD_STEPID" (1071 . 5)))

(0 . "NURBSURFACE")
(-3 ("ACAD_SURFACE_XFORM" (1011 0.0 0.0 0.0) (1011 1.0 0.0 0.0) (1011 0.0 1.0 0.0) (1011 0.0 0.0 1.0)))

(0 . "LOFTEDSURFACE")
(-3 ("ACAD" (1000 . "AcDbLoftSurfaceType") (1070 . 2)) ("ACAD_STEPID" (1071 . 4)) ("ACAD_SURFACE_XFORM" (1011 0.0 0.0 0.0) (1011 1.0 0.0 0.0) (1011 0.0 1.0 0.0) (1011 0.0 0.0 1.0)))

 

!? one step further, we have a difference between Loft and Network Surface now.

 

Sebastian

Message 5 of 7

doaiena
Collaborator
Collaborator

I know you said "not VL", but it is actually the easiest way. 

(vla-get-surfacetype (vlax-ename->vla-object (car (entsel))))

This is the output for the three surfaces in your file:

- "Loft with cross sections only"
- "NURBS"
- "Network"

Is there any particular reason you don't want to use VL?

Message 6 of 7

_gile
Consultant
Consultant
Accepted solution

Hi,

Simple, without VL, you can try :

 

(getpropertyvalue (car (entsel)) "SurfaceTypeName")

 



Gilles Chanteau
Programmation AutoCAD LISP/.NET
GileCAD
GitHub

Message 7 of 7

carlos_m_gil_p
Advocate
Advocate

Hello @_gile

Thank you very much for your solution.

It's the best I've learned.
With this, it solves more than one problem I have.

 

Thank you very much everyone for your collaboration, too.


AutoCAD 2026
Visual Studio Code 1.99.3
AutoCAD AutoLISP Extension 1.6.3
Windows 10 (64 bits)

0 Likes