Code conversion rhinocommon 4 to rhinocommon 6 c++


#1

@dale
I have just compiled an old code, it does not show any error in the code but showing huge difference about override. 73 errors. Syntax looks still the same. I forgot Rhino sdk c++ as most of the time I am writing c#. But I have few important algorithms from the past must need to be upgraded. They were working versions.
Can I send you the the project file, so you can see what are the differences and send me back with correction ?

class CMCubeDisplay : public CRhinoDisplayConduit
{
CMCubeDisplay();
public:
CMCubeDisplay(ON_PointCloud& grid_cloud, ON_PointCloud& ball_cloud)
: CRhinoDisplayConduit(CSupportChannels::SC_CALCBOUNDINGBOX |
CSupportChannels::SC_DRAWFOREGROUND)
, m_grid_cloud(grid_cloud)
, m_ball_cloud(ball_cloud)
{
};

bool   ExecConduit(CRhinoDisplayPipeline&, // pipeline executing this conduit
	UINT,                   // current channel within the pipeline
	bool&                   // channel termination flag
);

public:
ON_PointCloud & m_grid_cloud; // Something else has to keep this up to date.
ON_PointCloud& m_ball_cloud; // This just draws it
};


(Steve Baer) #2

Can you provide some of the error messages?


#3


(Steve Baer) #4

Those are intellisense errors. Make sure to change the drop-down that currently says “Build + Intellisense” to just “Build”


#5

What is the problem with this highlighted line? In the entire code, just this line looks incorrect, but I am not sure how to correct it.


(Steve Baer) #6

That function returns a pointer in V6 instead of a reference. You would need to adjust the line to read

CRhinoViewport* pVp = dp.GetRhinoVP();
if( nullptr==pVp )
  return truel
CRhinoViewport& vp = *pVP;

#7

Thank you Steve !


#8

Yes all intelliSense error has gone. But now giving two errors. It says pVP undeclared identifier, when I have implemented your code.


#9

pVP = typo? Only pVp seems to be declared.

// Rolf


#10

I do not use c++ .
Please tell me clearly what is wrong.

bool CMCubeDisplay::ExecConduit(CRhinoDisplayPipeline& dp,
UINT nActiveChannel,
bool& bTerminateChannel)
{
// Get the rhino viewport attached to the display pipeline…
//CRhinoViewport& vp = dp.GetRhinoVP();//.GetRhinoVP();
CRhinoViewport* pVp = dp.GetRhinoVP();
if (nullptr == pVp)
return true
CRhinoViewport& vp = *pVP;


(Steve Baer) #11

C++ is case sensitive. I accidentally typed in pVp in one case and pVP in another.


#12

Oh ! Yes… I did not see it either. I was looking at if there is any difference, but it did not caught my eyes. Thank you Steve.


#13

No one is laughing at you. And I don’t know C++ either. I’m just looking at the actual characters involved in the code snippet.

I pointed out something that looked like a typo. That means every character, and its Case, is important. In the following code (which is all I can see) there appears to be a typo: (pVp is not the same as pVP) :

Try modify the code above into:

CRhinoViewport* pVP = dp.GetRhinoVP(); 
if( nullptr==pVP ) 
    return true; 
CRhinoViewport& vp = *pVP;

See? Here all the pVP’s has a capital “P” at the end, not a lowercase as in the original snippet.

// Rolf


#14

OK, I now see that Steve answered already.


#15

Thanks for the reply ! OK, I misunderstood you. Deeply sorry.
I know c++ is case sensitive but pVp and pVP looks so similar it did not catch my eyes.