The DataCAD Developer Network (DDN) is an online resource for information and support for DCAL® (DataCAD Applications Language) developers as well as anyone interested in creating fonts, toolbars, hatch patterns, or linetypes for use in DataCAD.
#32433 by Jon C. Hubart
Wed Jan 30, 2008 4:41 pm
I have installed Visual C++ 2008 Express Edition and am trying to compile the Arrow sample file but am not having success. I am getting the following errors:
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(1436) : error C2143: syntax error : missing ')' before 'constant'
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(1436) : error C2143: syntax error : missing ';' before 'constant'
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(1436) : error C2059: syntax error : ')'
c:\program files\microsoft sdks\windows\v6.0a\include\msxml.h(1436) : error C2238: unexpected token(s) preceding ';'

Is this error indicating a problem with the msxml.h that comes with Visual C++? That doesn't sound right. Also I found no reference to 'constant' in that file.
.\Arrow.cpp(217) : error C2198: 'TPFwrtmsgerr' : too few arguments for call
.\Arrow.cpp(222) : error C2198: 'TPFwrtlvl' : too few arguments for call
.\Arrow.cpp(224) : error C2198: 'TPFlblset' : too few arguments for call
.\Arrow.cpp(225) : error C2198: 'TPFlblsett' : too few arguments for call
.\Arrow.cpp(227) : error C2198: 'TPFlblset' : too few arguments for call
.\Arrow.cpp(228) : error C2198: 'TPFlblset' : too few arguments for call
.\Arrow.cpp(232) : error C2198: 'TPFwrtmsgerr' : too few arguments for call
.\Arrow.cpp(234) : error C2198: 'TPFwrtmsgerr' : too few arguments for call
.\Arrow.cpp(245) : error C2198: 'TPFwrtmsgerr' : too few arguments for call

Is their something missing in here as well? perhaps this will go away when the first error is corrected.

Also, when I first ran the build, I was getting an error about the pre-compiled header stdafx.h. I changed the setting to "Create Precompiled Header (/Yc)". Will this come back to bite me later, or is this an error in the settings as issued with DCAL for C++?

I haven't programmed outside of legacy DCAL since the late 80's so my point of reference is limited.
#32455 by devinder
Thu Jan 31, 2008 9:27 am
I apologize that this macro was not tested under updated DCAL which got posted to the net. We will issue the update shortly.

Thank you
#32587 by Jon C. Hubart
Mon Feb 04, 2008 4:42 pm
I am getting closer to a working version of this macro. The "DEBUG" compile now appears to complete successfully albeit with many warnings to replace "strncpy" with "strncpy_s" .

When I look at the Debug folder I see a Arrow.dll. I renamed this to Arrow.dmx. Is this correct or should a correct compile process create a dmx file?

I then run the renamed arrow.dmx in DC12.05 and it appears to load properly so I think I'm on the right path here. Without adjusting any settings I enter the points for an arrow. When the arrow is created it contains a string of text "WFFontName C:\DataCAD 12\ Devinder" Now that doesn't look right. :D

I then adjust the width, enter points and get similar results.

I turn on Fill Color and enter points and upon selecting the second point the file closes. DataCAD stays open.

I open a new file and turn on "Fill Color" then select "Color" but nothing happens.

When I switch to "RELEASE" the compilation fails unable to find ShortString.h. I believe I will need to hardcoding the path to this file. Is that correct?

EDIT
I bypassed hardcoding the path by copying the DDK files into the arrow folder. Now when I compile the "RELEASE" I get similar results to the "DEBUG" compile.
#32602 by devinder
Tue Feb 05, 2008 9:21 am
If you study the code you will find the code is doing what it is intended to do. I admit this code is not a direct translation from pascal code and contains some text data as well. I did this because I thought this would be a good place to provide an example of how to use strings in a macro.
You can replace the code with following function to just get the arrow with fill

Code: Select allvoid addarrow(point pnt1, point pnt2, aFloat Width, bool isfill, aSInt fillcolor)
{
/*
   Input parameters: pnt1 - location of center tail of arrow
                     pnt2 - location of arrow tip
                     width - maximum width of arrow

   Note: This procedure uses NO global variables, only parameters which
         are passed to it.

                                                  o p5
                                                  |\
          p7                                      | \
            o-------------------------------------o  \
            |                                   p6    \
            |                                          \
       pnt1 o (local origin)                            o p4, pnt2
            |                                          /
            |                                   p2    /
            o-------------------------------------o  /
          p1                                      | /
                                                  |/
                                                  o p3
*/
   entity ent;
   point pnt[8]; /* discard pnt[0] */
   point tmppnt;
   int i;
   aFloat ang, len, cose, sine;
   attrib atr;
   /*
      This section of code calculates the x and y values for the 7 points
      of the arrow.  All of these calculations assume a local origin
      which is coincident with the center of the tail of the arrow.  The
      7 points are translated and rotated to reflect the position of the
      two input points pnt1 and pnt2.
   */

   len = distance(pnt1, pnt2);    /* arrow length from end to tip */
   ang = angle(pnt1, pnt2);       /* angle arrow makes with the +x-axis */

   pnt[1].x = 0.0;
   pnt[1].y = -Width / 4.0;

   pnt[2].x = len - Width / 2.0;
   pnt[2].y = -Width / 4.0;

   pnt[3].x = len - Width / 2.0;
   pnt[3].y = -Width / 2.0;

   pnt[4].x = len;
   pnt[4].y = 0.0;

   pnt[5].x = len - Width / 2.0;
   pnt[5].y = Width / 2.0;

   pnt[6].x = len - Width / 2.0;
   pnt[6].y = Width / 4.0;

   pnt[7].x = 0.0;
   pnt[7].y = Width / 4.0;

   /*
      This section of code rotates points 1 thru 7 about the local origin
      of the arrow by the angle of the line pnt1--pnt2, then translates
      each point from the local origin to the point pnt1.
   */

   cose = cos(ang);   /* pre-calculate these for speed */
   sine = sin(ang);

   for (i=1; i<=7; i++)
   {
      tmppnt = pnt[i];
      pnt[i].x = pnt1.x + tmppnt.x * cose - tmppnt.y * sine;
      pnt[i].y = pnt1.y + tmppnt.x * sine + tmppnt.y * cose;
      pnt[i].z = zbase();
   }

   /*
      This section of code creates polygon entity which outline
      the arrow.  Note that stopgroup is called before and after this
      process so that the entity will become its own group.
      Note that ent_init is first called for entity added to the
      database. The current settings for linetype, linecolor, lineweight,
      and lineovershoot will be assumed.
   */

   stopgroup;                    /* make the entity into a group */
   ent_init(ent, entply);
   ent.plynpnt = 7;
   for (i=1; i<=7; i++)
   {
      ent.plypnt[i-1] = pnt[i];
      ent.plyisln[i-1] = true;
   }
   if (!ent_add(ent))
      return;
   if (isfill)
   {
      atr = InitSolidFillAttribute(RGBtoDCADRGB(fillcolor),0,0);
      atr_add2ent(ent,atr);
   }
   ent_draw(ent, drmode_white);    /* draw the polygon on the screen */
   stopgroup;                    /* make the entity into a group */
}


Q. Why fill does not show up in original code?
A. A text entity was added after the polygon, and fill is a property of polygon entity and not text and thus fill would not show. The above code works because there is no text entity involved, or use a new entity variable for text entity creation.
NOTE: Currently InitSolidFillAttribute causes crash to the above source, so you will have to wait for next DataCAD release. Included code does not have any code to get the new fill color, or to say Color button does not do anything.

Q. Build Configuration in C++
A. It will all depend on the macro capabilities and will change accordingly, but you need to specify "Additional Include Directories" path to the DDK folder to fix "unable to find xxxx" file error message.
#32603 by Jon C. Hubart
Tue Feb 05, 2008 10:24 am
From what you "say" (write) it appears my results are the expected results at this time. That makes me feel better. Now I can move on to the next step. I will try converting some old code to familiarize myself with the new format. There are some tweaks I have been wanting to make anyhow.

Who is online

Users browsing this forum: No registered users and 23 guests

About DataCAD Forum

The DataCAD Forum is a FREE online community we provide to enhance your experience with DataCAD.

We hope you'll visit often to get answers, share ideas, and interact with other DataCAD users around the world.

DataCAD

Software for Architects Since 1984