Advertisement
bueddl

acad join poly entities vshadow

Jun 21st, 2016
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.88 KB | None | 0 0
  1.  
  2. void App::on_join()
  3. {
  4.     try
  5.     {
  6.         // Query user for two entities
  7.         Polyline primary = user_select_entity(L"Select first entity\n").cast<Polyline::db_type>();
  8.         // ...
  9.         Polyline secondary = user_select_entity(L"Select second entity\n").cast<Polyline::db_type>();
  10.  
  11.         // Open or create layer
  12.         Layer layer = Layer::open(L"test", true);      
  13.        
  14.         // Create joined polyline
  15.         Polyline joined = Polyline::create();
  16.         joined->upgradeOpen();
  17.         joined->setColorIndex(1);
  18.  
  19.         if (!primary.join(secondary, joined))
  20.             return;
  21.        
  22.         // And add to layer
  23.         layer.append(joined);
  24.     } catch (std::logic_error &ex)
  25.     {
  26.         acutPrintf(L"Logic error: %s\n", wstring(ex.what()).c_str());
  27.     } catch (std::runtime_error &ex)
  28.     {
  29.         acutPrintf(L"Runtime error: %s\n", wstring(ex.what()).c_str());
  30.     } catch (std::bad_alloc &ex)
  31.     {
  32.         acutPrintf(L"Allocation error: %s\n", wstring(ex.what()).c_str());
  33.     }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement