Trying to Create shape instance of master from custom library


Author
Message
Jason Irby
Jason Irby
Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)Forum Member (41 reputation)
Group: Forum Members
Posts: 59, Visits: 77

 

I guess this should be easy but i'm not getting it, and I haven't found anything in the examples that makes it clear.

 

I have a custom library that I have persisted out to file.

I have loaded this file into a NLibraryDocument thru the PersistencyManger.

I now want to create an NShape instance of one of the Masters within the LibraryDocument, and insert it into my drawing programatically.

I was looking for some kind of shape factory that could take my LibraryDocument and expose instantiation methods for the contained masters, but I haven't found anything like that.

How should I approach this.

Thanks in advance.

Regards,

Jason Irby

 

 

 

 


Nevron Support
Nevron Support
Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)Supreme Being (4.5K reputation)
Group: Administrators
Posts: 3.1K, Visits: 4.2K
Hi Jason,

Use the CreateInstance method of the master, which takes a drawing document and a center point. The method creates an instance of the master content in the active layer of the specified drawing document, and centers it at the specified point. For example:

master.CreateInstance(drawingDocument, new NPointF(100, 100));

In general a master is slightly more complex than a shape factory. The complexity arises from the fact that a shape factory creates only single shapes, while a master can contain multiple shapes and the connections between them. This means that not only single shapes, but entire drawing fragments (clippings) can be stored in masters for reuse in multiple drawings.

Best Regards,
Nevron Support Team


GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...




Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search