<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://communities.bentley.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>My own add feature function</title><link>https://communities.bentley.com/products/geospatial/desktop/f/bentley-map-forum/15127/my-own-add-feature-function</link><description>Hello,
 
 
I have defined, in Geospatial Administrator, a linestring feature. But I want to create/draw it in a special way. I have written my own MDL command supporting drawing orthogonal buildings process. And now I&amp;#39;d like to combine standard feature</description><dc:language>en-US</dc:language><generator>Telligent Community 12</generator><item><title>Re: My own add feature function</title><link>https://communities.bentley.com/thread/31445?ContentTypeID=1</link><pubDate>Tue, 20 Jan 2009 18:50:30 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:f8fcaa48-94e6-4872-94db-2bf3568f531f</guid><dc:creator>cdalesandro</dc:creator><description>&lt;p&gt;
Hello Myzzard,
&lt;/p&gt;
&lt;p&gt;
Here is a code snippet that I added to the GasMain MDL example to automatically annotate the feature after placement if the AutoAttribute system property is TRUE.&amp;nbsp; This system property setting&amp;nbsp;is available in the Feature pulldown menu.
&lt;/p&gt;
&lt;code&gt;
&lt;p&gt;
Public void placeGasMain_secondPoint
&lt;/p&gt;
&lt;p&gt;
(
&lt;/p&gt;
&lt;p&gt;
Dpoint3d *pntP,
&lt;/p&gt;
&lt;p&gt;
int view
&lt;/p&gt;
&lt;p&gt;
)
&lt;/p&gt;
&lt;p&gt;
{
&lt;/p&gt;
&lt;p&gt;
BoolInt autoAttribute = FALSE;
&lt;/p&gt;
&lt;p&gt;
generateGasMain (pntP, view);
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
xfmFeature_write (gasMainFeature, FALSE);
&lt;/p&gt;
&lt;p&gt;
xfmFeature_savePreferenceProperties (gasMainFeature, L&amp;quot;placing&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
// If auto-attributing after placement is on then activate Annotate method (if it exists)
&lt;/p&gt;
&lt;p&gt;
xfmPropMgr_getPropertyBoolValue (&amp;amp;autoAttribute, L&amp;quot;SysProps/AutoAttribute&amp;quot;, FALSE);
&lt;/p&gt;
&lt;p&gt;
if (autoAttribute)
&lt;/p&gt;
&lt;p&gt;
{
&lt;/p&gt;
&lt;p&gt;
BoolInt annotateMethodExists=FALSE;
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_methodExists (&amp;amp;annotateMethodExists, L&amp;quot;GasMain&amp;quot;, L&amp;quot;Annotate&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
if (!annotateMethodExists)
&lt;/p&gt;
&lt;p&gt;
{
&lt;/p&gt;
&lt;p&gt;
placeGasMain_done();
&lt;/p&gt;
&lt;p&gt;
return;
&lt;/p&gt;
&lt;p&gt;
}
&lt;/p&gt;
&lt;p&gt;
// --- set group to edit as required by annotate logic ---
&lt;/p&gt;
&lt;p&gt;
xfmFeature_setFeatureGroup (gasMainFeature, L&amp;quot;edit&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
// Since not opening edit box, initialize &amp;quot;editing&amp;quot; properties in case required for annotation
&lt;/p&gt;
&lt;p&gt;
xfmFeature_initializeProperties (gasMainFeature, L&amp;quot;editing&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
// --- set locatedFeatureRootName which is required by edit logic ---
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_setProperty (L&amp;quot;locatedFeatureRootName&amp;quot;, L&amp;quot;GasMain&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_setProperty (L&amp;quot;locatedFeatureGroupName&amp;quot;, L&amp;quot;edit&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
// --- start up the feature's Annotate Method ---
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_activateMethod (L&amp;quot;GasMain&amp;quot;, L&amp;quot;Annotate&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
return;
&lt;/p&gt;
&lt;p&gt;
} 
&lt;/p&gt;
&lt;p&gt;
placeGasMain_done();
&lt;/p&gt;
&lt;p&gt;
}
&lt;/p&gt;
&lt;/code&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Also of interest is this snippet from the XFM Standard Operations Library which will open the edit dialog box before annotation if system properties are set to do so.
&lt;/p&gt;
&lt;code&gt;
&lt;p&gt;
/*
&lt;/p&gt;
&lt;p&gt;
If &amp;quot;SysProps/AutoAttribute&amp;quot; == TRUE
&lt;/p&gt;
&lt;p&gt;
If &amp;quot;SysProps/OpenEditDialogDuringAutoAttribution&amp;quot; == FALSE
&lt;/p&gt;
&lt;p&gt;
start annotation placement (run &amp;quot;Annotate&amp;quot; method)
&lt;/p&gt;
&lt;p&gt;
Else
&lt;/p&gt;
&lt;p&gt;
open Edit box (run &amp;quot;Edit&amp;quot; method)
&lt;/p&gt;
&lt;p&gt;
Else
&lt;/p&gt;
&lt;p&gt;
restart current XFM command (placement)
&lt;/p&gt;
&lt;p&gt;
*/
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
xfmPropMgr_getPropertyBoolValue (&amp;amp;autoAttribute, L&amp;quot;SysProps/AutoAttribute&amp;quot;, FALSE);
&lt;/p&gt;
&lt;p&gt;
if (autoAttribute) 
&lt;/p&gt;
&lt;p&gt;
{
&lt;/p&gt;
&lt;p&gt;
MSWChar* featureName=NULL;
&lt;/p&gt;
&lt;p&gt;
MSWChar* featureAlias=NULL;
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_getProperty (&amp;amp;featureName, L&amp;quot;placementFeature&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_getProperty (&amp;amp;featureAlias, L&amp;quot;placementAlias&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
BoolInt annotateMethodExists=FALSE;
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_methodExists (&amp;amp;annotateMethodExists, featureName, L&amp;quot;Annotate&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
BoolInt openEditBox = TRUE;
&lt;/p&gt;
&lt;p&gt;
xfmPropMgr_getPropertyBoolValue (&amp;amp;openEditBox, L&amp;quot;SysProps/OpenEditDialogDuringAutoAttribution&amp;quot;, FALSE);
&lt;/p&gt;
&lt;p&gt;
if (openEditBox)
&lt;/p&gt;
&lt;p&gt;
{
&lt;/p&gt;
&lt;p&gt;
// --- check for Edit and Annotate Methods for current feature ---
&lt;/p&gt;
&lt;p&gt;
BoolInt editMethodExists=FALSE;
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_methodExists (&amp;amp;editMethodExists, featureName, L&amp;quot;Edit&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
if (annotateMethodExists &amp;amp;&amp;amp; editMethodExists)
&lt;/p&gt;
&lt;p&gt;
{
&lt;/p&gt;
&lt;p&gt;
XfmFeatureP editFeature=NULL;
&lt;/p&gt;
&lt;p&gt;
if (SUCCESS == xfmFeatureMgr_loadFeatureFromList (&amp;amp;editFeature, placementGroup, featureAlias))
&lt;/p&gt;
&lt;p&gt;
{
&lt;/p&gt;
&lt;p&gt;
// --- set group to edit as required by edit logic ---
&lt;/p&gt;
&lt;p&gt;
xfmFeature_setFeatureGroup (editFeature, L&amp;quot;edit&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
// --- set locatedFeatureRootName which is required by edit logic ---
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_setProperty (L&amp;quot;locatedFeatureRootName&amp;quot;, featureAlias);
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_setProperty (L&amp;quot;locatedFeatureGroupName&amp;quot;, L&amp;quot;edit&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
// --- start up the feature's Edit Method ---
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_activateMethod (featureName, L&amp;quot;Edit&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
if (NULL != featureOps)
&lt;/p&gt;
&lt;p&gt;
dlmSystem_mdlFree (featureOps);
&lt;/p&gt;
&lt;p&gt;
if (NULL != placementGroup)
&lt;/p&gt;
&lt;p&gt;
dlmSystem_mdlFree (placementGroup);
&lt;/p&gt;
&lt;p&gt;
if (NULL != featureName)
&lt;/p&gt;
&lt;p&gt;
dlmSystem_mdlFree (featureName);
&lt;/p&gt;
&lt;p&gt;
if (NULL != featureAlias)
&lt;/p&gt;
&lt;p&gt;
dlmSystem_mdlFree (featureAlias);
&lt;/p&gt;
&lt;p&gt;
if (NULL != editFeature)
&lt;/p&gt;
&lt;p&gt;
xfmFeature_free (&amp;amp;editFeature);
&lt;/p&gt;
&lt;p&gt;
return;
&lt;/p&gt;
&lt;p&gt;
}
&lt;/p&gt;
&lt;p&gt;
if (NULL != editFeature)
&lt;/p&gt;
&lt;p&gt;
xfmFeature_free (&amp;amp;editFeature);
&lt;/p&gt;
&lt;p&gt;
}
&lt;/p&gt;
&lt;p&gt;
}
&lt;/p&gt;
&lt;p&gt;
else
&lt;/p&gt;
&lt;p&gt;
{
&lt;/p&gt;
&lt;p&gt;
if (annotateMethodExists)
&lt;/p&gt;
&lt;p&gt;
{
&lt;/p&gt;
&lt;p&gt;
XfmFeatureP editFeature=NULL;
&lt;/p&gt;
&lt;p&gt;
if (SUCCESS == xfmFeatureMgr_loadFeatureFromList (&amp;amp;editFeature, placementGroup, featureAlias))
&lt;/p&gt;
&lt;p&gt;
{
&lt;/p&gt;
&lt;p&gt;
// --- set group to edit as required by annotate logic ---
&lt;/p&gt;
&lt;p&gt;
xfmFeature_setFeatureGroup (editFeature, L&amp;quot;edit&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
// Since not opening edit box, initialize &amp;quot;editing&amp;quot; properties in case required for annotation
&lt;/p&gt;
&lt;p&gt;
xfmFeature_initializeProperties (editFeature, L&amp;quot;editing&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
// --- set locatedFeatureRootName which is required by edit logic ---
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_setProperty (L&amp;quot;locatedFeatureRootName&amp;quot;, featureAlias);
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_setProperty (L&amp;quot;locatedFeatureGroupName&amp;quot;, L&amp;quot;edit&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
// --- start up the feature's Annotate Method ---
&lt;/p&gt;
&lt;p&gt;
xfmCmdMgr_activateMethod (featureName, L&amp;quot;Annotate&amp;quot;);
&lt;/p&gt;
&lt;p&gt;
if (NULL != featureOps)
&lt;/p&gt;
&lt;p&gt;
dlmSystem_mdlFree (featureOps);
&lt;/p&gt;
&lt;p&gt;
if (NULL != placementGroup)
&lt;/p&gt;
&lt;p&gt;
dlmSystem_mdlFree (placementGroup);
&lt;/p&gt;
&lt;p&gt;
if (NULL != featureName)
&lt;/p&gt;
&lt;p&gt;
dlmSystem_mdlFree (featureName);
&lt;/p&gt;
&lt;p&gt;
if (NULL != featureAlias)
&lt;/p&gt;
&lt;p&gt;
dlmSystem_mdlFree (featureAlias);
&lt;/p&gt;
&lt;p&gt;
if (NULL != editFeature)
&lt;/p&gt;
&lt;p&gt;
xfmFeature_free (&amp;amp;editFeature);
&lt;/p&gt;
&lt;p&gt;
return;
&lt;/p&gt;
&lt;p&gt;
}
&lt;/p&gt;
&lt;p&gt;
if (NULL != editFeature)
&lt;/p&gt;
&lt;p&gt;
xfmFeature_free (&amp;amp;editFeature);
&lt;/p&gt;
&lt;p&gt;
}
&lt;/p&gt;
&lt;p&gt;
}
&lt;/p&gt;
&lt;p&gt;
if (NULL != featureName)
&lt;/p&gt;
&lt;p&gt;
dlmSystem_mdlFree (featureName);
&lt;/p&gt;
&lt;p&gt;
if (NULL != featureAlias)
&lt;/p&gt;
&lt;p&gt;
dlmSystem_mdlFree (featureAlias);
&lt;/p&gt;
&lt;p&gt;
}
&lt;/p&gt;
&lt;/code&gt;
&lt;p&gt;
&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
Regards,
&lt;/p&gt;
&lt;p&gt;
Chris
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: My own add feature function</title><link>https://communities.bentley.com/thread/30903?ContentTypeID=1</link><pubDate>Fri, 16 Jan 2009 15:08:29 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:99ac62c7-0f33-492c-b5b2-d0c0afd9354f</guid><dc:creator>Mariusz Mycielski</dc:creator><description>&lt;p&gt;
Hello, 
&lt;/p&gt;
&lt;p&gt;
I have also used Place (MDL Handler) example command and created my own function inserting an ellipse element by two points.
&lt;/p&gt;
&lt;p&gt;
This example shows how to create a feature, but I want to add an annotation text after that. How can I do it? How to complete my function to call annotation command? 
&lt;/p&gt;
&lt;p&gt;
Myzzard 
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: My own add feature function</title><link>https://communities.bentley.com/thread/29570?ContentTypeID=1</link><pubDate>Fri, 09 Jan 2009 18:25:46 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:27f6dab8-fd42-4fa8-921d-759d3c9a169a</guid><dc:creator>cdalesandro</dc:creator><description>&lt;p&gt;
Hello Mariusz,
&lt;/p&gt;
&lt;p&gt;
Use the xfmPropMgr_getPropertyXXX functions to get an operation property value.
&lt;/p&gt;
&lt;p&gt;
Regards,
&lt;/p&gt;
&lt;p&gt;
Chris
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: My own add feature function</title><link>https://communities.bentley.com/thread/29559?ContentTypeID=1</link><pubDate>Fri, 09 Jan 2009 18:00:22 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:c13e599a-31d0-4e4a-89b6-547657be2bd2</guid><dc:creator>Mariusz Mycielski</dc:creator><description>&lt;p&gt;
&lt;sub&gt;One another question...&lt;/sub&gt;
&lt;/p&gt;
&lt;p&gt;
I have defined my command like in geo_example.xml Place(MDL) for GasMain feature.
&lt;/p&gt;
&lt;p&gt;
How can I get an operation's property in MDL? I have one property defining width of buffer rectangle that I draw. And I want to catch it in MDL while creating a feature. 
&lt;/p&gt;
&lt;p&gt;
Mariusz 
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: My own add feature function</title><link>https://communities.bentley.com/thread/29550?ContentTypeID=1</link><pubDate>Fri, 09 Jan 2009 16:46:53 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:7f93bee0-96d5-44a2-bcaf-dc1ac7a25dc8</guid><dc:creator>Mariusz Mycielski</dc:creator><description>&lt;p&gt;
Chris,
&lt;/p&gt;
&lt;p&gt;
I can always bank on you! Thanks a lot. These examples were very helpful for me.
&lt;/p&gt;
&lt;p&gt;
Regards,
&lt;/p&gt;
&lt;p&gt;
Mariusz 
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: My own add feature function</title><link>https://communities.bentley.com/thread/29418?ContentTypeID=1</link><pubDate>Thu, 08 Jan 2009 21:14:09 GMT</pubDate><guid isPermaLink="false">6dad98f5-dbc9-4c4d-a9ba-e9da8dc6aa8e:751d20ad-240b-405a-9ecd-b8fb8fb53e28</guid><dc:creator>cdalesandro</dc:creator><description>&lt;p&gt;
Hello Myzzard,
&lt;/p&gt;
&lt;p&gt;
In geo_example schema, take a look at the GasMain feature where there are a number of GasMain placement methods. See method &amp;quot;Place(MDL)&amp;quot; which starts keyin &amp;quot;place gasmain&amp;quot; when the method is activated.&amp;nbsp; Also see method &amp;quot;Place(MDL Handler)&amp;quot; which is an example of a custom MDL procedure which uses the same setup as other XFM standard MDL procedures.&amp;nbsp; The MDL source is in mdl\examples\gasmain\.
&lt;/p&gt;
&lt;p&gt;
Regards,&amp;nbsp;
&lt;/p&gt;
&lt;p&gt;
&amp;nbsp;Chris
&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>