Jump to content

Create Materials


jan_ek

Recommended Posts

Hello

Can you help me create features that adds material.

I would only set four parameters:

Name:Test1

Diffuse:Inherit

Ambient:Inherit

Transparency:20

 

 

 

 

Other parameters as 0 or inactive.

 

 

 

 

Preferably with the use of entmake

Link to comment
Share on other sites

Just a quick run of code here. A mix of AutoLisp and VisualLisp

 

(setq acadapp (vlax-get-acad-object));Get the Acad App

(setq adoc (vlax-get-property acadapp 'ActiveDocument));Get the ActiveDocument

(setq mats (vlax-get-property adoc 'Materials));Get the Materials Collection

(setq mymat (vlax-invoke-method mats 'Add "Test1"));Add a New Material

(setq d (dictsearch (namedobjdict) "ACAD_MATERIAL"));Get the Material Dictionary

(setq mymatent (cdr (cadr (member (cons 3 "Test1") d))));Get your new Material Entity Name

(setq entd (entget mymatent));Get the Enity Data of your new Material

 

Use the link that Lt. Dan's Legs has provided for you to entmod your material.

 

I hope this helps!

 

regards,

 

Hippe013

Link to comment
Share on other sites

just a note hippe013,

 

cdadr equals the same results as (cdr (cadr

 

 

and you could've also used

(dictsearch (cdar (dictsearch (namedobjdict) "ACAD_MATERIAL")) "Test1")

That would return the same result as entd

Link to comment
Share on other sites

just a note hippe013' date='

 

[b']cdadr[/b] equals the same results as (cdr (cadr

 

 

and you could've also used

(dictsearch (cdar (dictsearch (namedobjdict) "ACAD_MATERIAL")) "Test1")

That would return the same result as entd

 

Thanks for the tip!

Link to comment
Share on other sites

Thank you for your help.

The material was able to create.

I have one more question:

1. I've created a solid

2. Change the material on BYBlock

3. One change material, but only on one surface solid (for example "Ble1")

 

Is there a way to restore all of the surface of a single material?

Link to comment
Share on other sites

  • 1 month later...

I also want to do what the OP was trying to do. My problem is with altering the transparency of the material. There is no material group code for material transparency in the link Lt Dan's Legs left. In the materials editor there is the ability to alter the transparency of any material though.

 

How could altering the transparency of the material be done via vlisp?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...