Hi,
I'm wondering if anybody can offer advice as I'm getting pretty frustrated trying to work out what I am doing wrong in the following code:
This is part of a function that produces a new polyline by offsetting an existing polyline. Subsequent logic does an ent_draw of the created pln entity and it is being drawn exactly as expected. But ...
I have tested this in Both DataCAD 20 & 21. I was initially building this using the Header Files supplied with DataCAD 17, but have now tried it with both the DataCAD 20 & 21 header files with the same result
As far as I can see, the logical steps that create this polyline are the same as I have used to create polylines elsewhere ( i.e. ent_init followed by a series of polyvert_init and assigning values to the pv fields before doing a polyvert_add and finally set plnclose and do an ent_add). None of the other polylines created by these same logical steps have this problem.
I tried adding an ent_add immediately after the ent_init and an ent_update after each polyvert_add (and changing the existing ent_add to an ent_update), but this did not change the symptoms.
I have debugged this logic processing a simple rectangular polyline and confirmed that all the points added have valid initialized x, y, & z values and in the example I debugged then shape was zero (pv_vert) in every case. Can't think what else to check.
I'm probably missing something blatantly obvious, but if anybody can offer any guidance then I would be most grateful.
I'm wondering if anybody can offer advice as I'm getting pretty frustrated trying to work out what I am doing wrong in the following code:
Code: Select all
// create a new polyline based on the NewLines list
ent_init (pln, entpln);
for i := 0 to NewLines.Count-1 do begin
NewLine := NewLines[i];
polyvert_init (pv);
pv.shape := NewLine.shape;
if pv.shape = pv_vert then begin
pv.bulge := 0.0;
pv.pnt := NewLine.pt1;
pv.nextpnt := NewLine.pt2;
end
else begin
arc_to_bulge (NewLine.cntr, NewLine.rad, NewLine.bang, NewLine.eang, NewLine.ccw,
pv.pnt, pv.nextpnt, pv.bulge);
end;
polyvert_add (pv, pln.plnfrst, pln.plnlast);
end;
pln.plnclose := true;
ent_add (pln);
This is part of a function that produces a new polyline by offsetting an existing polyline. Subsequent logic does an ent_draw of the created pln entity and it is being drawn exactly as expected. But ...
- if I redraw the screen (using 'u' key) the polyline disappears (refreshing from DL using 'Esc' does not cause it to disappear)
- every entity that I create on the same layer after the creation of this polyline behaves the same way (i.e. disappears if the screen is redrawn). If I change to another layer then entities can be created as normal (they do not dissapear with a redraw).
- if I delete and then restore subsequent entities on the layer (using ',' then '.') then they are drawn on the screen again, but disappear if I press 'u' to redraw the screen
- If I delete all subsequent entities and then press '<' to delete the group containing the polyline then I get 'DataCAD (internal diagnostics) fault 28 Error from: XXX' (where XXX varies ... I have seen values of 736, 73, 77)
- If I delete all subsequent entities and then press ',' to delete just the polyline then it is deleted and pressing '.' will restore it and draw it on the screen. What's more, mostly if I redraw the screen after deleting and then restoring the polyline then everything is back to normal (the polyline together with any subsequent entities that have been deleted and then restored are shown on the screen correctly by a redraw, also any new entities that are subsequently added do not disappear on a redraw). I say 'mostly' because at least once when I tested this everything has not been back to normal
I have tested this in Both DataCAD 20 & 21. I was initially building this using the Header Files supplied with DataCAD 17, but have now tried it with both the DataCAD 20 & 21 header files with the same result
As far as I can see, the logical steps that create this polyline are the same as I have used to create polylines elsewhere ( i.e. ent_init followed by a series of polyvert_init and assigning values to the pv fields before doing a polyvert_add and finally set plnclose and do an ent_add). None of the other polylines created by these same logical steps have this problem.
I tried adding an ent_add immediately after the ent_init and an ent_update after each polyvert_add (and changing the existing ent_add to an ent_update), but this did not change the symptoms.
I have debugged this logic processing a simple rectangular polyline and confirmed that all the points added have valid initialized x, y, & z values and in the example I debugged then shape was zero (pv_vert) in every case. Can't think what else to check.
I'm probably missing something blatantly obvious, but if anybody can offer any guidance then I would be most grateful.
David Henderson
dhSoftware - Add-on Macros for DataCAD
dhSoftware - Add-on Macros for DataCAD