Versions Compared

Key

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

...

The Navigation Cube labels may be customized. However, the Axis Triad lacks such support at the time of this article.

Instructions

The following describes the process of customizing the labels of the Axis Triad in HPS:

  1. Using the hps_mfc_sandbox project, add the following function to CHPSView.cpp;

    Code Block
    void DoSetAxisText(HPS::SegmentKey seg, const char* text)
    {
    	HPS::SearchResults result;
    	if (seg.Find(Search::Type::Text, Search::Space::Subsegments, result) > 0)
    	{
    		HPS::SearchResultsIterator it = result.GetIterator();
    		while (it.IsValid())
    		{
    			HPS::Key key = it.GetItem();
    			if (key.Type() == HPS::Type::TextKey)
    			{
    				HPS::TextKey sKey = (TextKey)key;
    				// set other text properties e.g. sKey.SetSize(16, HPS::Text::SizeUnits::Pixels);
    				sKey.SetText(text);
    			}
    			it.Next();
    		}
    	}
    }
  2. Next add the following to the User Code 3 method of the CHPSView class;

    Code Block
    void CHPSView::OnUserCode3()
    {
    	_canvas.GetFrontView().GetAxisTriadControl().SetVisibility(true).SetLocation(HPS::AxisTriadControl::Location::BottomLeft);
    	_canvas.GetFrontView().GetNavigationCubeControl().SetInteractivity(true);
    }
  3. Additionally, add the following to the User Code 4 method of the CHPSView class;

    Code Block
    void CHPSView::OnUserCode4()
    {
    	SegmentKey viewSegKey = GetCanvas().GetFrontView().GetSegmentKey();
    
    	if (viewSegKey.Type() != HPS::Type::None)
    	{
    		SearchResults searchResults;
    		size_t numResults = viewSegKey.Find(Search::Type::Segment, Search::Space::SubsegmentsAndIncludes, searchResults);
    		if (numResults > 0)
    		{
    			SearchResultsIterator it = searchResults.GetIterator();
    			while (it.IsValid())
    			{
    				Key key = it.GetItem();
    				SegmentKey segKey(key);
    				if (segKey.Name() == "hps_axis_triad")
    				{
    					SegmentKey hpsAxisKey = segKey;
    					if (hpsAxisKey.Type() != HPS::Type::None)
    					{
    						SegmentKeyArray sub;
    						hpsAxisKey.ShowSubsegments(sub);
    
    						for (size_t i = 0; i < sub.size(); i++)
    						{
    							HPS::SegmentKey sk = sub.at(i);
    							HPS::UTF8 s = sk.Name();
    
    							if (s == "x") //X-Axis
    							{
    								DoSetAxisText(sk, "A");
    							}
    							else if (s == "y") //Y-Axis
    							{
    								DoSetAxisText(sk, "B");
    							}
    							else if (s == "z") //Z-Axis
    							{
    								DoSetAxisText(sk, "C");
    							}
    						}
    
    					}
    				}
    				it.Next();
    			}
    		}
    	}
    	GetCanvas().UpdateWithNotifier().Wait();
    }
  4. Build and launch the mfc_sandbox

  5. On the User Code tab, click on the User Code 3 button to enable the Axis Triad

    Image Removed

  6. Click on the User Code 4 button to modify the Axis Triad labels;

    Image Removed

 

...

For more information, check out our forum post.

Filter by label (Content by label)
showLabelsfalse
max5
spacescom.atlassian.confluence.content.render.xhtml.model.resource.identifiers.SpaceResourceIdentifier@2318a5
sortmodified
showSpacefalse
reversetrue
typepage
cqllabel in ( "kb-how-to-article" , "axis" , "triad" , "customize" ) and type = "page" and space = "KBHV"
labelskb-how-to-article

...