The topic FAQ will summarize the most recently asked questions about the Android SDK.
How can I change the ESnap box size?
Status | ||
---|---|---|
|
Status | ||||
---|---|---|---|---|
|
The ESnap box size is a system controlled value (DYNASNAPSIZE) and can be changed or read via C++ as follow:
Code Block |
---|
GetFxSystemServices()->GetHostAppServices()->setDYNASNAPSIZE( YOUR_DYNASNAPSIZE ); GetFxSystemServices()->GetHostAppServices()->getDYNASNAPSIZE(); |
Note: The ESnap box size varies with the display resolution to the Android device. We recommend to update the value YOUR_DYNASNAPSIZE
with the Android display metrics and apply the correct device dependent multiplier. This ensure the ESnap box will have the same size on all devices.
Code Block |
---|
Resources res = m_ARES.getResources(); int iDynsnapSize = (int) TypedValue.applyDimension( TypedValue.COMPLEX_UNIT_DIP, YOUR_DYNASNAPSIZE, res.getDisplayMetrics() ); |
Database values like PDSIZE and PDMODE can be changed via C++ as follow:
Code Block |
---|
ACTIVE_DOCUMENT()->GetFxDatabase()->setPDSIZE( YOUR_PDSIZE ); ACTIVE_DOCUMENT()->GetFxDatabase()->setPDMODE( YOUR_PDMODE ); |
Hint: Use ARES Commander to get the correct values you want to use inside your mobile application.
How can I load custom fonts?
Status | ||
---|---|---|
|
The CFxARESInstanceDelegate offers a method getFontsPath() that allows the host application to load its own fonts. Overwriting (@Override) the method will make the kernel SDK read the fonts location from the host application. The fonts path returned must point to an existing and accessible location on the device.
Code Block | ||
---|---|---|
| ||
public class ARESDelegate extends CFxARESInstanceDelegate { ... @Override public String getFontsPath() { // Returns the path with custom fonts folder. // The path should contain custum fonts and 'fontConfig.xml' file which tells ARES instance what fonts to load. // 'fontConfig.xml' supports two configuration options: // 1. Substitution. User defines a set of fonts which should be used instead of the missing one. // In the example Arimo fonts substitute Arial font family. // <family name="Arial"> // <style filename="Arimo-Regular.ttf" /> // <style filename="Arimo-Italic.ttf" /> // <style filename="Arimo-Bold.ttf" /> // <style filename="Arimo-BoldItalic.ttf" /> // </family> // 2. Direct font loading. User specifies the filename to be loaded. In this case ARES will parse the font file and load // everything as is. // <fontfile filename="msgothic.ttc"/> // <fontfile filename="msmincho.ttc"/> // return "assets:/Fonts/"; } ... } |
The kernel SDK also expects to read a special XML file (fontConfig.xml) from this location. This file is treated as some sort of index and specifies what fonts are loaded and which fonts are supposed to substitute missing fonts. So make sure both the fontConfig.xml and all referenced fonts exist inside the device location.
Hint: The sample application DWG Editor uses this concept.
How to select entities by type and layer name?
Status | ||||
---|---|---|---|---|
|
The class CFxUserIO offers a method DoSSGet(...) that allows to pass the selection set to be processed and additionally conditions about what entities are qualified to be selected. The main selection set can be accessed via GetFxMainSelectionSet() from class CFxDocument. The filter is a fdt_resbufW that can be constructed from a builder GetFxAPI()->fdt_buildlistW(). GetFxAPI() can be accessed from CFxDocument. The builder fdt_buildlistW supports to specify a list of parameter. The list of parameter is terminated by a 0.
To specify a filter based on entity type and layer name, the builder should be constructed as follow:
Code Block |
---|
fdt_buildlistW( RTDXF0, "DXFNAME", // Set DXF-name 8, "LAYERNAME", // Set layer name 0 ); // Termination 0 |
DXF Name | Entity type |
---|---|
LINE | OdDbLine |
CIRCLE | OdDbCircle |
POINT | OdDbPoint |
For more class identifiers you can run the following LISP routine inside ARES Commander. ((-1 . <EName: 00000000551fe260>) (0 . "LINE") (5 . "10B") (330 . <EName: 0000000034f2d000>) (100 . "AcDbEntity") (67 . 0) (410 . "Model") (8 . "0") (100 . "AcDbLine") (10 132.6 148.5 0.0) (11 303.0 255.9 0.0) (210 0.0 0.0 1.0)) |
The command context CFxCommandContext is accessible inside the method Execute() from class CFxCommand. We recommend to always use commands but in rare cases the CFxDocument can be also accessed via ACTIVE_DOCUMENT().
Code Block |
---|
// Get main selection CFxSelectionSet* pFxSelSet = pCmdCtx->GetFxDocument()->GetFxMainSelectionSet(); // Construct resbuf with (dxf code - value) pairs to filter object for selection. Filter works as white-list. fdt_resbufW *pFilter = pCmdCtx->GetFxDocument()->GetFxAPI()->fdt_buildlistW( RTDXF0, "CIRCLE", // Set DXF-name 8, "MYLAYER", // Set layer name 0 ); // Termination 0 // Do select with filter. pCmdCtx->GetFxDocument()->GetFxUserIO()->DoSSGet( CFxUserIO::eFilter, // Set filter mode pFxSelSet, CFxUserIO::eKwSSGet, L"", L"", pFilter, // Set filter 0 ); // Release filter pCmdCtx->GetFxDocument()->GetFxAPI()->fdt_relrbW( pFilter ); |
How to change entity snap settings?
Status | ||||
---|---|---|---|---|
|
The entity snap settings are a system controlled value (OSMODE) and can be changed or read via C++ as follow:
Code Block |
---|
GetFxSystemServices()->GetHostAppServices()->setOSMODE( YOUR_OSMODE ); GetFxSystemServices()->GetHostAppServices()->getOSMODE(); |
The value is a bit combination that can be constructed by the values in the table down below:
Type | Value |
---|---|
Clear | 0 |
Endpoint | 1 |
Midpoint | 2 |
Center | 4 |
Node | 8 |
Quadrant | 16 |
Intersection | 32 |
Insertion | 64 |
Perpendicular | 128 |
Tangent | 256 |
Nearest | 512 |
Apparent | 2048 |
Extension | 4096 |
Parallel | 8192 |
All set | 16383 (Combined) |
Hint: To get the correct value for combined bits, OSMODE system variable can be also checked with ARES Commander. Type OSMODE in the command line to read the current entity snap settings value.