🙏Enter data to entities with data object - AutoCAD Map 3D.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
Hello everyone.
I hope they are doing well.
I need to create a Lisp command for AutoCAD MAP 3D and when selecting an entity identify which layer it is on.
If the feature is in a layer beginning with “POST_”, prompt or allow to enter the street name, after the street name is entered, prompt to enter the height of the street, then prompt to enter the height in meters , then request to enter the material and finally request to enter the state in which it is located.
If the feature is in a layer beginning with “PROPERTY_”, prompt or allow to enter the street name, once the street name is entered, prompt to enter the height of the street, then prompt to enter the number of floors, then request to enter the number of apartments, and finally request to enter the number of stores.
Then that data is collected, I need it to be saved in the Data Object of the selected element.
I was analyzing how to do the command, but I have no idea how to do it. I got a little help from bing chat and chatgpt, but I'm sure that what they did is not right because you have to know how to program lisp and I don't know.
I only see that the data can be entered, but I have no idea how to save the data in the OD:POST and OD:PROPERTY.
I leave here the code that was generated.
(defun c:test (/ ss ent layername streetname height floors apartments stores material state)
(setq ss (ssget))
(if ss
(progn
(setq ent (ssname ss 0))
(setq layername (cdr (assoc 8 (entget ent))))
(princ (strcat "\nLa entidad seleccionada se encuentra en la capa: " layername))
(cond
((= "POSTE_" (substr layername 1 6))
(setq streetname (getstring "\nIngrese el nombre de la calle: "))
(setq height (getreal "\nIngrese la altura de la calle en metros: "))
(setq material (getstring "\nIngrese el material: "))
(setq state (getstring "\nIngrese el estado: "))
; Aquí puedes hacer algo con streetname, height, material y state.
)
((= "PROPIEDAD_" (substr layername 1 10))
(setq streetname (getstring "\nIngrese el nombre de la calle: "))
(setq height (getreal "\nIngrese la altura de la calle en metros: "))
(setq floors (getint "\nIngrese el número de pisos: "))
(setq apartments (getint "\nIngrese el número de departamentos: "))
(setq stores (getint "\nIngrese el número de locales: "))
; Aquí puedes hacer algo con streetname, height, floors, apartments y stores.
)
(t
(princ "\nLa capa no tiene un formato reconocido.")
)
)
)
(princ "\nNo se ha seleccionado ninguna entidad.")
)
(princ)
)
I hope you can help me.
Thank you so much.