Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

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.

Coming soon.Image Added

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

Status
titleOBJ-C
Status
colourYellow
titleC++

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

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

File: AppDelegate.mm

Code Block
-(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];
    }
}