Sign in to follow this  
zero_divide

C-Hook Adding Custom Material to the Material List

Recommended Posts

Hello,

I am getting a material from the Material Library and then Adding material with the following 2 methods (C++/CLR code):

	bool COperation::GetMaterial(String ^ mat_name, CMaterial ^%ctp)
	{
		bool result = false;
		ent opEnt;
		if (TpMainMatMgr.GetMainMatList().DatabaseRetrieve(mat_name, opEnt))
		{
			ctp = gcnew CMaterial(opEnt);
			result = true;
		}
		return result;
	}

	bool COperation::AddMaterial(CMaterial ^ctp)
	{
		bool result = false;
		ent opEnt;
		
		String2CharA(ctp->name, opEnt.u.matl.name);
		String2CharA(ctp->comment, opEnt.u.matl.comment);
		
		if (TpMainMatMgr.GetMainMatList().Add( opEnt.u.matl )>0)
		{
			result = true;
		}
		return result;
	}

I am ONLY setting the name and comment at this point.

It works just fine and the new material is in the list.

Yet when I re-open MasterCam, the material is gone.

I am sure there is something simple i need to do to make it save, but just can't figure out what is.

Thanks in advance!

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

  • Recently Browsing   0 members

    No registered users viewing this page.

Join us!

eMastercam - your online source for all things Mastercam.

Together, we are the strongest Mastercam community on the web with over 56,000 members, and our online store offers a wide selection of training materials for all applications and skill levels.

Follow us