Jump to content
Developer Wiki and Function Reference Links ×

Viewport annotation in VW12


BillW

Recommended Posts

I have a large environment built with Vectorscript which works perfectly in VW11-11.5

I have ported to VW12 PC with the system broken in one major respect. I automatically create sheet layers with elevations/plans as viewports of a 3D model, each viewport contains annotations and some are cropped. Running in VW12 PC my sheet/viewport creation scripts hang in VW12

Is there anything I should be aware of with changes to VW12? I would appreciate some help from NNA

The logic of the script is

make model layer active

set model view ie FRONT

draw crop rectangle on model layer

draw dimension/notes objects on model layer and store handles to objects

create viewport on sheet layer

set viewport crop object

>>>>>>>>>>hangs system on this call

attach dimension/notes objects to viewport using handles to objects stored previously

set viewport details

set viewport layers

set viewport classes

move viewport to correct position on sheet layer

I also update the viewport. I have also tried changing the order of the calls ie putting annotation last but with no success

The offending function is

function AddVPAnnotationObject(vportH,objH);

If I strip out all annotation calls the sheet/viewports are built correctly.

The code snippet is below

>>>>>>>>>>>> hangs VW12

procedure setvpannotate(vportH : HANDLE; objlist : array[1..200] of HANDLE; objcnt : INTEGER);

Var

i : INTEGER;

btest : BOOLEAN;

begin

for i := 1 to objcnt do btest := AddVPAnnotationObject(vportH,objlist);

end;

>>>>>>>>>>>>>>>>>>>>>>main call

lscal := getlscale(designlyrH);

cx2 := 0; {elevations at origin}

cy2 := (shedabove-((shedabove+shedbelow)/2))/lscal/2;

layer(kSHEDLYR);

setviewtype(viewtype);

rect(-shedlength/2,shedabove+kCROPBORDER,shedlength/2,-(shedbelow+kCROPBORDER));

cropobjH:= Lnewobj;

setls(cropobjH,0);

objcnt := 0;

case dimtype of

kDIMELEVFRONT : dimelevfront(viewtype,lscal,shedabove,shedbelow,FALSE,showdims);

kDIMELEVBACK : dimelevfront(viewtype,lscal,shedabove,shedbelow,TRUE,showdims);

kDIMELEVLEFT : dimelevleft(viewtype,lscal,shedabove,shedbelow,TRUE,showdims);

kDIMELEVRIGHT : dimelevleft(viewtype,lscal,shedabove,shedbelow,FALSE,showdims);

end;

vpH := createVP(sheetlyrH);

croptest := setvpcropobject(vpH,cropobjH);

>>>>>Hangs system

setvpannotate(vpH,annotlist,objcnt);

setvpdetails(vpH,0,kVPWIREFRAME,viewtype,vwscale,1,TRUE,TRUE); {kVPHIDDENLINE kVPWIREFRAME}

layernames[1] := kSHEDLYR;

setvplayervis(vpH,layernames,1,kNOCHECK,kVISIBLE,FALSE);

setelevclass(dimtype);

setclass(vpH,kVWPGENCLASS);

layer(getlname(sheetlyrH));

hmove(vpH,cx1-cx2,cy1-cy2);

Link to comment
  • 3 weeks later...

Not much response yet from NNA!!!

I have reason to beleive that Viewport annotation is broken at VW 12

I drew a rectangle, added two dimensions and a text block on the design layer and created a viewport. I did an Export Vectorscript (which currently doesnt handle viewport annotation).

I edited the Vectorscript file to add viewport annotation. If I do an Import>Vectorscript then Vectorworks hangs. Could somebody else please check this out - see code below. I am running VW 12 on PC.

If a single object is added as annotation I have seen it work. If I draw a point object on the design layer and check its parent type I get 11 - a group and NOT 31 a layer

{----------------------------------------------}

Procedure LoadFile;

VAR

hatchName, gradientName, objectName:STRING;

result, index, segmentIndex:INTEGER;

boolResult:BOOLEAN;

top, left, bottom, right:REAL;

tempHandle, tempHandle1, tempHandle2, gradientHandle, objectHandle, layerHandle, viewportHandle:HANDLE;

obj1,obj2,obj3 : HANDLE; {---- added to standard Vectorscript export}

BEGIN

{VectorWorks Version 12.0.0 (49891)}

{Global Characteristics}

DrwSize(1,1);

SetUnits(0,1,0,25.400000000000006,'mm',' sq mm');

PrimaryUnits(0,1,1,2,6,FALSE,FALSE);

SecondaryUnits(7,1,2,FALSE,FALSE);

SetPrefLongInt(162,1);

SetPrefLongInt(169,1);

SetPrefLongInt(171,3);

SetPrefLongInt(172,3);

SetPrefLongInt(212,1);

SetPrefLongInt(219,1);

SetPrefLongInt(221,3);

SetPrefLongInt(222,3);

SetPrefInt(174,0);

SetPrefInt(224,0);

SetPref(167,FALSE);

SetPref(173,TRUE);

SetPref(223,TRUE);

SetPref(175,FALSE);

SetPref(225,FALSE);

GridLines(9.999999999346619);

PenGrid(1.999999999346617);

SetPrefReal(73,0);

SetOriginAbsolute(0,0);

SetPref(37,TRUE);

SetPref(38,TRUE);

SetPref(5,FALSE);

OpenPoly;

SetDashStyle(TRUE,2,0.041656,0.041672);

SetDashStyle(TRUE,2,0.097214,0.041671);

SetDashStyle(TRUE,2,0.208328,0.041672);

SetDashStyle(TRUE,2,0.263885,0.041657);

SetDashStyle(TRUE,2,0.013885,0.027771);

SetDashStyle(TRUE,4,0.125,0.041656,0.013886,0.027786);

SetDashStyle(TRUE,6,0.125,0.041656,0.125,0.041672,0.013886,0.027786);

SetDashStyle(TRUE,6,0.125,0.041656,0.013886,0.027786,0.013886,0.027786);

SetDashStyle(TRUE,4,0.75,0.055557,0.138886,0.055557);

SetDashStyle(TRUE,6,0.75,0.055557,0.138886,0.055557,0.125,0.0625);

SetPrefInt(121,0);

SetPrefReal(68,0);

SetPrefReal(69,0);

SetPrefReal(70,1);

{End of Global Characteristics}

{Record Format Entries}

{Begin Visible Record Format Entries}

{End of Visible Record Format Entries}

{Begin Hidden Record Format Entries}

NewField('NNACartoon','Family','7',1,0);

SetObjectVariableBoolean(GetObject('NNACartoon'),900,FALSE);

NewField('NNACartoon','Prototype','1',1,0);

SetObjectVariableBoolean(GetObject('NNACartoon'),900,FALSE);

NewField('NNACartoon','Version','1',1,0);

SetObjectVariableBoolean(GetObject('NNACartoon'),900,FALSE);

NewField('NNACartoon','Line Color','0',1,0);

SetObjectVariableBoolean(GetObject('NNACartoon'),900,FALSE);

NewField('NNACartoon','Line Color G','0',1,0);

SetObjectVariableBoolean(GetObject('NNACartoon'),900,FALSE);

NewField('NNACartoon','Line Color B','0',1,0);

SetObjectVariableBoolean(GetObject('NNACartoon'),900,FALSE);

NewField('NNACartoon','Line Width','1',3,0);

SetObjectVariableBoolean(GetObject('NNACartoon'),900,FALSE);

{End of Hidden Record Format Entries}

{End of Record Format Entries}

{Worksheet Entries}

{End of Worksheet Entries}

{Gradient Definition Entries}

{End of GradientDefinition Entries}

{Hatch Definition Entries}

{End of Hatch Definition Entries}

{Symbol Library Entries}

{End of Symbol Library Entries}

{Layer Characteristics}

layerHandle := CreateLayer('Design Layer-1', 1);

SetScale(100.00000000000003);

ShowLayer;

CopyMode(8);

LFillFore(0,0,0);

LFillBack(65535,65535,65535);

LPenFore(0,0,0);

LPenBack(65535,65535,65535);

Projection(6,0,11899.391999999614,-5949.6959999991541,5949.6959999991541,5949.6959999991541,-5949.6959999991541);

{End of Layer Characteristics}

{Object Creation Code}

NameClass('None');

PenSize(2);

PenPat(2);

FillPat(1);

PenFore(0,0,0);

PenBack(65535,65535,65535);

FillFore(0,0,0);

FillBack(65535,65535,65535);

Rect(-999.99999999934687,999.99999999934687,999.99999999934687,-999.99999999934687);

TextFont(GetFontID('Arial'));

TextSize(9);

TextFace([]);

TextFlip(0);

TextRotate(0);

TextSpace(2);

TextJust(1);

TextVerticalAlign(1);

TextOrigin(-4649.9999999993479,3099.9999999993474);

BeginText;

'text'

EndText;

obj1 := Lnewobj; {---- added to standard Vectorscript export}

NameClass('Dimension');

SetDimStd(5);

LinearDim(-999.99999999934687,999.99999999934687,999.99999999934687,999.99999999934687,1749.999999999347,0,1795,771,0);

SetPrimaryDim(LNewObj,TRUE,FALSE,'','',1);

SetSecondaryDim(LNewObj,TRUE,FALSE,'[',']',1);

obj2 := Lnewobj; {---- added to standard Vectorscript export}

LinearDim(999.99999999934687,999.99999999934687,999.99999999934687,-999.99999999934687,1599.999999999347,1,1795,771,0);

SetPrimaryDim(LNewObj,TRUE,FALSE,'','',1);

SetSecondaryDim(LNewObj,TRUE,FALSE,'[',']',1);

obj3 := Lnewobj; {---- added to standard Vectorscript export}

SetZVals(0,0);

{Layer Characteristics}

layerHandle := CreateLayer('Sheet Layer-1', 2);

boolResult := SetSheetLayerUserOrigin(layerHandle,0,0);

{End of Layer Characteristics}

{Object Creation Code}

NameClass('None');

NameObject('Viewport-1');

{Begin Viewport: 'Viewport-1'}

{Creation}

objectHandle := GetObject('Sheet Layer-1');

viewportHandle := CreateVP(objectHandle);

{Viewport Layer Visibilities}

layerHandle := GetObject('Design Layer-1');

boolResult := SetVPLayerVisibility (viewportHandle, layerHandle, 0);

{Viewport Class Visibilities}

boolResult := SetVPClassVisibility (viewportHandle, 'None', 0);

boolResult := SetVPClassVisibility (viewportHandle, 'Dimension', 0);

{Viewport Data}

SetObjectVariableReal (viewportHandle,1003,20);

SetObjectVariableInt (viewportHandle,1000,6);

SetObjectVariableInt (viewportHandle,1001,0);

SetObjectVariableReal (viewportHandle,1002,23.425);

SetObjectVariableBoolean (viewportHandle,1005,TRUE);

SetObjectVariableLongInt (viewportHandle,1006,0);

boolResult := SetViewMatrix (viewportHandle,0,0,0,0,0,0);

{Viewport Annotation ---- added to standard Vectorscript export}

message(concat('Object types = ',gettype(obj1),' ',gettype(obj2),' ',gettype(obj3),' ----starting add annotatoin'));

boolResult := AddVPAnnotationObject(viewportHandle,obj1);

boolResult := AddVPAnnotationObject(viewportHandle,obj2);

boolResult := AddVPAnnotationObject(viewportHandle,obj3);

message('After add annotation');

ResetObject (viewportHandle);

GetBBox (viewportHandle, left, top, right, bottom);

HMove (viewportHandle,-90 - left,100 - top);

{End Viewport: 'Viewport-1'}

SetZVals(0,0);

{End of Creation Code}

{Classes}

NameClass('None');

SetClFillFore('None',0,0,0);

SetClFillBack('None',65535,65535,65535);

SetClPenFore('None',0,0,0);

SetClPenBack('None',65535,65535,65535);

SetClFPat('None',1);

SetClLS('None',2);

SetClLW('None',2);

SetClUseGraphic('None',FALSE);

NameClass('Dimension');

SetClFillFore('Dimension',0,0,0);

SetClFillBack('Dimension',65535,65535,65535);

SetClPenFore('Dimension',0,0,0);

SetClPenBack('Dimension',65535,65535,65535);

SetClFPat('Dimension',1);

SetClLS('Dimension',2);

SetClLW('Dimension',2);

SetClUseGraphic('Dimension',FALSE);

{End of Class Entries}

{Default Attributes}

PenSize(2);

PenPat(2);

FillPat(1);

Marker(0,0.125,15);

PenFore(0,0,0);

PenBack(65535,65535,65535);

FillFore(0,0,0);

FillBack(65535,65535,65535);

{End of Default Attributes}

END;

Run(LoadFile);

Link to comment
  • 2 weeks later...

Still trying to sort out annotation problem. I got a response I didnt expect.

anobjH := GetVPGroup(vportH,2); {2 = Annotation}

alrtdialog(concat(gettype(vportH),' ',gettype(anobjH),' ',anobjH));

This returns 122 0 0

Which signifies I have a handle to a Viewport but no handle to the annotation layer.

I wonder what is happening? Is there a cetain point when Viewport layers are created?

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...