The DWG Editor carries the basic features and extends the creation and editing capabilities of entities.
...
Features
Create new drawings
Change system variable CECOLOR
Offer basic drawing and editing tools
List and insert existing block definitions
Show custom help content
DWG Editor - Create new drawings
Status | ||
---|---|---|
|
...
File: ARES_Simplified_JNI.cpp
Code Block | ||
---|---|---|
| ||
JNIEXPORT jobjectArray JNICALL Java_com_graebert_dwgeditor_JNI_GetBlockNames( JNIEnv * env, jclass clazz ) { if ( ACTIVE_DOCUMENT() == 0 ) return nullptr; CFxDatabasePtr pDB = ACTIVE_DOCUMENT()->GetFxDatabase(); if ( pDB.isNull() ) return nullptr; OdDbBlockTablePtr pBlockTable = pDB->getBlockTableId().openObject(OdDb::kForRead); if ( pBlockTable.isNull() ) return nullptr; OdStringArray blockNames; OdDbSymbolTableIteratorPtr iterator = pBlockTable->newIterator(); for ( ; !iterator->done(); iterator->step() ) { OdDbBlockTableRecordPtr pBlockTableRecord = iterator->getRecord(); OdString blockName = pBlockTableRecord->getName(); if ( blockName.isEmpty() ) continue; if ( blockName.getAt(0) == L'*' ) continue; if ( pBlockTableRecord->isAnonymous() ) continue; if ( pBlockTableRecord->isLayout() || pBlockTableRecord->isFromExternalReference() ) continue; blockNames.push_back( blockName ); } jclass stringClass = GET_JAVA()->FindClass( "java/lang/String" ); CFxJavaObjectArray result( blockNames.size(), stringClass ); jsize index = 0; for ( const CFxString& name : blockNames ) { CFxJavaString javaString( name ); result.SetElement( index, javaString.GetStrongJString() ); index++; } return reinterpret_cast<jobjectArray >( result.GetStrongJObject() ); } |
File: MainActivity.java
Code Block | ||
---|---|---|
| ||
String m_Blocks[] = null;
public void DocumentActivated( String[] layouts, String[] blocks )
{
m_Blocks = blocks;
...
}
private void InsertBlock()
{
if ( m_Blocks == null || m_Blocks.length == 0 )
{
AlertDialog.Builder warningMessage = new AlertDialog.Builder( this );
warningMessage.setTitle( getResources().getString( R.string.app_name ) );
warningMessage.setMessage( "No blocks to insert in this drawing." );
warningMessage.create().show();
return;
}
AlertDialog.Builder builder = new AlertDialog.Builder( this );
builder.setTitle("Select block");
builder.setItems( m_Blocks, new DialogInterface.OnClickListener()
{
@Override
public void onClick(DialogInterface dialog, int which)
{
String command = "_-INSERTBLOCK\n\"" + m_Blocks[which] + "\"\n\\1.0\n1.0\n0.0\n";
CFxARESInstance.instance().runCommand(command);
}
});
builder.setNegativeButton("Cancel", null);
AlertDialog dialog = builder.create();
dialog.show();
} |
DWG Editor - Show custom help content
Status | ||
---|---|---|
|
Status | ||||
---|---|---|---|---|
|
The SDK is shipped without a command help but the standard user input shows a help button. To hide the help button just use SetUIConfigruation() from CFxARESInstance. More details read here → DWG Expert - Create a custom UI for command prompts
The delegate method onHelp() of CFxARESInstanceDelegate allows to react whenever the user taps on the help button of a certain command. The command name is provided in English only.
File: CFxARESDelegate.java
Code Block | ||
---|---|---|
| ||
@Override
public void onHelp(String command)
{
// Show custom help content
} |