function AddUserDefineShapefromLib(ALibManager:TLibManager; UDShapeName:string;CenterX,CenterY:integer;OwnerCAD:TMyCAD):    Integer;


Description:


 Get from library by UDshapename . and add user-defined  shape into TMyCAD instance,it is a important function in TMyCAD


Return Value:


      -1: Add failed

else(>=0):   The new shape's shapeId.


Parameter:


 ALibManager:the instance of a library

  UDShapeName : the name of a combine shape;

CenterX,CenterY:the shape's center position that you want placed;

OwnerCAD:this shape will be added .


Example:


var

    mLibManager:TLibManager;

begin

if (FileExists(FileName)) and (IsTCADLibFile(FileName)) then

begin

       mLibManager:=TLibManager.Create;

       mLibManager.LoadFromFile(LibFileName);

       MyCAD1.AddUserDefineShapefromLib( mLibManager, 'MyShapename',100,100,MyCAD1);

       mLibManager.Free;

end;

end;



See also:


AddShapeByCode

AddImageShapeByCode

OnShapeAdded