Apache2k 发表于 2022-7-5 18:18:11

LISP Materials (textures, shad

I have been trying to find some sources how to handle materials via LISP but it seems to be impossible to get anything out.
 
Is it so that Lisp cant handle the material library?
 
I have a custom material library containing materials that i want to attach to the selected block. Not to layer.
 
vla-put-material seems to be an option but don't know how to use it.
 
Any help is welcome.

Tharwat 发表于 2022-7-5 18:52:28

Hi,
 
The materials that is inserted into current drawing as a collection :
 

(vla-get-materials (vla-get-activedocument (vlax-get-acad-object)))
 
and to assign materials to 3D objects, the material object name should be an item in the collection to be able to add it to any object with the function:
 

(vla-put-material)
 
I didn't work with materials with Lisp before but with some tests I come up with the above.

Apache2k 发表于 2022-7-5 19:01:13

Thank you Tharwat, but i have to say that i still don't get this   :) To i have to move my custom material from my material library first to the document material library? and can dis be done via LISP or VLA?

Tharwat 发表于 2022-7-5 19:35:23

I think yes it is possible and we can try that since we would loss nothing
We can create a temporary 3D object and assign the materials that you want to use to it , then delete the temporary object so the materials would be available in current drawing.
 
Upload a few material to see the type of these files.
 
What do you think?
页: [1]
查看完整版本: LISP Materials (textures, shad