Skip to end of metadata
Go to start of metadata

You are viewing an old version of this content. View the current version.

Compare with Current View Version History

« Previous Version 5 Current »

The DWG Expert addresses the possibilities to customize the core features especially in the ways to introduce more powerful tools to the UI part of the application.

Features

  • List blocks from external sources 

  • Insert blocks from external sources

  • Create a custom UI for command prompts

  • Access entity properties

DWG Expert - List blocks from external sources OBJ-C C++

To accomplish a feature like a block library the DWG Expert introduces a simple block container. The block container is a NSMutableArray that stores the block definition name and a corresponding thumbnail. The block container is created and initialized with all blocks from the assets calling -(void)BuildBlockLibrary when CFxARESDelegate triggers onInitializationDone(). The method onInitializationDone() is called only once each application session. The block container uses -(UIImage*)getDrawingThumbnail:(NSString*)drawing from singleton CFxARESInstance to create a block preview. 

File: CFxAresDelegate.mm

-(void)onInitializationDone
{
    ...    
    [_application BuildBlockLibrary];
}

File: AppDelegate.m

@interface AppDelegate ()
{
    ...
    NSMutableArray* m_BlockLibrary;
}

-(void)BuildBlockLibrary
{
    // Prepare block library.
    NSString *bundlePath = [[aresDelegate resourceBundle] bundlePath];
    NSString *dwgSamplesPath = [bundlePath stringByAppendingString:@"/Support/Samples/Blocks"];
    NSArray *filePaths = [NSBundle pathsForResourcesOfType:@"dwg" inDirectory:dwgSamplesPath];

    m_BlockLibrary = [NSMutableArray array];
    for ( NSString* drawing in filePaths )
    {
        BlockDefinition* block = [[BlockDefinition alloc] init];
        
        block._blockFilePath = drawing;
        block._blockName = [drawing lastPathComponent];
        block._icon = [[CFxARESInstance instance] getDrawingThumbnail:drawing];
        
        [m_BlockLibrary addObject:block];
    }
}
  • No labels