Jump to content

BillW

Member
  • Posts

    77
  • Joined

  • Last visited

Everything posted by BillW

  1. I am trying to shorten a nurbs curve. There is an "ExtendNurbsCurve" function but no shorten option. I can move the start point of a nurbs curve with the following code curveH := CreateDuplicateObject(srcH,NIL); if (startoffset > 0) then begin curvelen := hlength(srcH); inPercentOfLength := startoffset / curvelen; if GetPointAndParameterOnNurbsCurveAtGivenLength(curveH,inPercentOfLength,px,py,pz,outParam,outIndex) then begin NurbsSetPt3D(curveH,0,outIndex,px,py,pz); resetobject(curveH); end; end; The problem is with getting the curve alignment correct. I assume I have to set the correct knot values for curve vertex points 0 and 1 with NurbsSetKnot(objH,curveH,0,0) and NurbsSetKnot(objH,curveH,0,1). I can get the existing knot values with NurbsKnot(srcH,curveH,0,0) and NurbsKnot(objH,srcH,0,1) . The question is how will the knot values change - what is the relationship? TIA Bill Wood
  2. That's the problem solved. Thanks vey much. Bill Wood
  3. Marissa, I loaded your script into my VW file - see attached. Weird, I still cannot get it to run. The VW file has popups which do run. I am on Windows 7 Professional SP1 and VW 2018 SP1. Previously, I pretty much made the same sort of edits as your version. angle test.vwx
  4. Marissa, I tried your suggestions but still cannot get any output ie from Marionette.PortOut('Type') even with debug set. I tried various things including merging the content and params classes, replacing the .nodename and .nodedesc with fixed strings and even externally building the getcontent() full string and embedding as a fixed string. I even upgraded Vectorworks 2018 to SP 1 and set Marionette preferences>Cache Last Run in Debug On and Off. I have the feeling that Marionette.WidgetType.Popup does not like long lists. I also understand that by default the popup widget returns a number relating to the selected item from the list. Can you try at your end to see if you can get it to work - it might be my VW installation.
  5. Thanks Marissa. I managed to get the popup filled with content from a standard plugin data file - see below. For some reason I cannot get any output from the node ie self.Params.sectionsize.value = sectionType Tried passing the output to an alertdialog node - nothing. Is it the definition of class content before @Marionette.NodeDefinition causing the problem. import os class content: nodename = "Angle-Metric" nodedesc = 'Select an Angle-Metric section size' def getcontent(): fref = os.path.join(vs.GetFolderPath(20) , 'Angle-Metric.txt' ) content = [] if os.path.exists(fref): f = open(fref) line = f.readline() # First line not used line = f.readline() while line: sline = line.split('\t',1) content.append(sline[0]) line = f.readline() f.close() else: content = ['Undefined'] return content @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): #APPEARANCE #Name this = Marionette.Node( content.nodename ) this.SetDescription( content.nodedesc ) #OIP Controls sectionType = Marionette.OIPControl('Section Type', Marionette.WidgetType.Popup, 0, content.getcontent() ) sectionType.SetDescription( "List of valid section types" ) #Output Ports sectionsize = Marionette.PortOut('Type') sectionsize.SetDescription( "The resultant section definition" ) #BEHAVIOR def RunNode(self): #inputs sectionType = self.Params.sectionType.value #outputs self.Params.sectionsize.value = sectionType
  6. Trying to tie some of my tools into Marionette. Before diving in further, is it possible to dynamically fill a popup controls choice content from say a text file? Can I add a function to class Params and reference in the OIPControl definition (ie this.getcontent('options.txt')) - see below (example from Marionette website) TIA Bill Wood @Marionette.NodeDefinition class Params(metaclass = Marionette.OrderedClass): this = Marionette.Node( 'Add' ) a = Marionette.PortIn( 0 ) b = Marionette.PortIn( 0 ) out = Marionette.PortOut() k = Marionette.OIPControl( 'Multiplier', Marionette.WidgetType.Real, 1) p10 = Marionette.OIPControl( 'Popup', Marionette.WidgetType.Popup, 0, ['choice 1', 'choice 2']) def RunNode(self): sum = self.Params.a.value + self.Params.b.value self.Params.out.value = sum * self.Params.k.value
  7. Raymond Thanks for the code, much simpler. In the desperate need to finish the code, I didn't see/manage to pick up your code in time. I did it a slightly different way which seems to work fine - see below Thanks anyway. Bill Wood procedure getpolydef(polyH : HANDLE; vertnum : INTEGER); Var j : INTEGER; p1,p2,p3 : VECTOR; v1,v2 : VECTOR; ang,testang : REAL; ang1,ang2 : REAL; begin for j := 1 to vertnum do begin GetPolyPt(polyH ,j,p2.x,p2.y); {test vertex} if (j = numvert) then GetPolyPt(polyH,1,p3.x,p3.y) {next vertex} else GetPolyPt(objH,j+1,p3.x,p3.y); if (j=1) then GetPolyPt(objH,numvert,p1.x,p1.y) {previous vertex} else GetPolyPt(objH,j-1,p1.x,p1.y); pathdef[j].x := p2.x; pathdef[j].y := p2.y; ang := Rad2Deg(ArcCos(DotProduct(UnitVec(p1-p2), UnitVec(p3-p2)))); {angle between 3 points always positive} v1.x := p2.x-p1.x; v1.y := p2.y-p1.y; v2.x := p3.x-p1.x; v2.y := p3.y-p1.y; ang1 := vec2ang(v1); ang2 := vec2ang(v2); testang := ang1-ang2; {work out angle direction from test point to to point} if testang >= 180 then pathdef[j].angle := -ang else if testang >= 0 then pathdef[j].angle := ang else if testang < -180 then pathdef[j].angle := ang else pathdef[j].angle := -ang; end; end; {getpolydef}
  8. Banging my head against the wall on this one. I am testing a polygon. If I have 3 vertices, "start point", "test point", "to point" - I can test the angle between the 3 points using the logic of the developer example PROCEDURE Example; VAR pt1, pt2, pt3, pt4 :VECTOR; ang :REAL; BEGIN GetPt(pt1.x, pt1.y); {start point} GetPtL(pt1.x, pt1.y, pt2.x, pt2.y); {test point} GetPtL(pt2.x, pt2.y, pt3.x, pt3.y); {to point} MoveTo(pt1.x, pt1.y); LineTo(pt2.x, pt2.y); LineTo(pt3.x, pt3.y); pt4 := (pt1 + pt3) / 2; {Find the angle between the vectors.} ang := Rad2Deg(ArcCos(DotProduct(UnitVec(pt1-pt2), UnitVec(pt3-pt2)))); TextOrigin(pt4.x, pt4.y); CreateText(Concat(ang)); END; RUN(Example); This always returns a positive angle. What I need to find out is if the "to point" is to the left (-ive) or right (+ive) of a vector "start point" to "test point" I tried comp(p2-p1,p3-p1,v3,v4) with v4 orthogonal to p2-p1 I thought I could test v4.y for +ive or -ive sense but cant seem to get it to work. TIA Bill Wood
  9. For a tool I think you can try x1,y1 = vs.vstGetCurrPt2D() or - not tried in code yet outX, outY, outZ = vs.vstGetCurrPt3D(result) As an aside I had a Vectorscript tool with Getpt(x1,y1) Getptl(x1,y1,x2,y2) {rubberband line} and couldn't get the Python version of Getptl to work.
  10. In Vectorscript I have shape drawing functions that have a unit embedded so they work in any current units ie 10.7mm This doesn't work in Python. I have two examples that work - see attached files "convertnumbers 1" and "convertnumbers 2" What I want to do with "convertnumbers 2" is overload the standard Python number or float so I can type for example 10.7.mm or (10.7).mm if the double period causes problems. Any thoughts Thanks PS Couldn't find a way for an inline format 10.7.mm but have found a way with format vwu.mm(10.7) see attached file "convertnumbers 3"
  11. I have a set of menu commands and tools that I have written in python with all the code for each contained within the respective Script Editor window ie no external code import/modules etc. I thought I would try and encrypt (ie PC ctrl+alt+shift with capslock set) a simple menu command "Test menu" containing code vs.AlrtDialog('Menu command') I get an error "Test menu.xml" not found. I understand from previous posts that the xml must exist if the form Common/__init__.py Common/Vector.py Common/Utilities.py Common/ObjsType.py MyDialog.py MainProgram.py but if I have no external files ie code is totally encapsulated. what do I put in the xml file?? see attached Thanks
  12. I just had a dig around some ancient code which may be useful I used two procedures for manipulating VP classes and layers with a range of options including wildcarding names. Restricted to maximum 200 classes and 200 layers. procedure example; {By Bill Wood 2010} Const {Viewport layer and class visibility} kVISIBLE = 0; kINVISIBLE = 1; kGREYED = 2; {Viewport Class/Layer build} kNOCHECK = 1; kINCLUSION = 2; kEXCLUSION = 3; {Layer names} kGRIDLYR = 'Grid layer'; kSHEDLYR = 'Build layer'; Var vpH : HANDLE; classnames,layernames : array[1..200] of STRING; classcnt : INTEGER; procedure setvpclassvis(vportH : HANDLE; classnames : array[1..200] of STRING; classcnt,genmethod,visibility : INTEGER; forceothersalternate : BOOLEAN); Label 100,150; Var i,j,altvisible : INTEGER; classfnd,btest : BOOLEAN; classtest : array[1..200] of BOOLEAN; classstr : array[1..200] of STRING; starpos : INTEGER; begin case visibility of kINVISIBLE: altvisible := kVISIBLE; kVISIBLE: altvisible := kINVISIBLE; end; case genmethod of kNOCHECK: begin for i := 1 to classcnt do btest := setvpclassvisibility(vportH,classnames,visibility); end; kINCLUSION: begin for i := 1 to classcnt do begin starpos := pos('*',classnames); classtest := (starpos <> 0); if classtest then begin if (starpos = 1) then classstr := copy(classnames,2,len(classnames)-1) else classstr := copy(classnames,1,starpos-1); end else classstr := classnames; end; for i := 1 to classnum do begin classfnd := FALSE; for j := 1 to classcnt do begin if classtest[j] then classfnd := (pos(classstr[j],classlist(i)) <> 0) else classfnd := (classstr[j] = classlist(i)); if classfnd then goto 100; end; 100: if classfnd then btest := setvpclassvisibility(vportH,classlist(i),visibility) else if forceothersalternate then btest := setvpclassvisibility(vportH,classlist(i),altvisible); end; end; kEXCLUSION: begin for i := 1 to classcnt do begin starpos := pos('*',classnames); classtest := (starpos <> 0); if classtest then begin if (starpos = 1) then classstr := copy(classnames,2,len(classnames)-1) else classstr := copy(classnames,1,starpos-1); end else classstr := classnames; end; for i := 1 to classnum do begin classfnd := FALSE; for j := 1 to classcnt do begin if classtest[j] then classfnd := (pos(classstr[j],classlist(i)) <> 0) else classfnd := (classstr[j] = classlist(i)); if classfnd then goto 150; end; 150: if classfnd then btest := setvpclassvisibility(vportH,classlist(i),visibility) else if forceothersalternate then btest := setvpclassvisibility(vportH,classlist(i),altvisible); end; end; end; end; {setvpclassvis} procedure setvplayervis(vportH : HANDLE; layernames : array[1..200] of STRING; lyrcnt,genmethod ,visibility : INTEGER; forceothersalternate : BOOLEAN); Label 100,150; Var i,j,altvisible : INTEGER; layerfnd,btest : BOOLEAN; lyrH : HANDLE; lyrname : STRING; begin case visibility of kINVISIBLE: altvisible := kVISIBLE; kVISIBLE: altvisible := kINVISIBLE; end; case genmethod of kNOCHECK: begin for i := 1 to lyrcnt do btest := setvplayervisibility(vportH,getlayerbyname(layernames),visibility); end; kINCLUSION: begin lyrH := flayer; while (lyrH <> NIL) do begin layerfnd := FALSE; lyrname := getlname(lyrH); for j := 1 to lyrcnt do begin if (layernames[j] = lyrname) then begin layerfnd := TRUE; goto 100; end; end; 100: if layerfnd then btest := setvplayervisibility(vportH,lyrH,visibility) else if forceothersalternate then btest := setvplayervisibility(vportH,lyrH,altvisible); lyrH := nextlayer(lyrH); end; end; kEXCLUSION: begin lyrH := flayer; while (lyrH <> NIL) do begin layerfnd := FALSE; lyrname := getlname(lyrH); for j := 1 to lyrcnt do begin if NOT (layernames = lyrname) then begin layerfnd := TRUE; goto 150; end; end; 150: if layerfnd then btest := setvplayervisibility(vportH,lyrH,visibility) else if forceothersalternate then btest := setvplayervisibility(vportH,lyrH,altvisible); lyrH := nextlayer(lyrH); end; end; end; end; {setvplayervis} begin {create viewport first} layernames[1] := kGRIDLYR; layernames[2] := kSHEDLYR; setvplayervis(vpH,layernames,2,kNOCHECK,kVISIBLE,FALSE); classnames[1] := 'Concrete-Panel*'; classnames[2] := 'Cladding*'; classnames[3] := 'Flashing*'; setvpclassvis(vpH,classnames,3,kEXCLUSION,kINVISIBLE,TRUE); {Alternatively} classcnt := 1; classnames[classcnt] := 'Colour*'; classcnt := classcnt + 1; classnames[classcnt] := 'Purlin Bay-Wall-A1:A*'; setvpclassvis(vpH,classnames,classcnt,kINCLUSION,kVISIBLE,FALSE); end; run(example);
  13. BillW

    Redline tool

    Thanks Pat - just what I thought. How long do you reckon it would take to write the Red Line tool from scratch with the same functionality? I wish NNA would make their tools open source - as back in the old days of MiniCAD. There would be benefits as NNA users could customise how they want tools to work not how NNA assumes they should work. Bill Wood
  14. I need to edit the way the Redline Tool works. I want to change the colour of a Redline when the "Picked Up" checkbox is clicked. At the moment it is forced to pen Yellow. Is there a setting somewhere or is it hard coded to Yellow. I checked for a class but the "Redlines" class is the only one I found and it doesnt seem to matter what colours are set - always RED for unpicked up and Yellow for picked up. I had a look for something in VWA preferences - nothing I looked in the Redline tool script "Strings" - nothing Any help would be appreciated Bill Wood
  15. Pat - Thanks very much - just what I wanted. The line should read without the extra G though DoMenuTextByName('Import Single DXFDWG File',0); I agree with the sentiments that you should be able to interrogate the internal constants. I have used both Sketchup Ruby and Maxscript which both have an inspect mechanism. Documentation invariably has errors. Thanks Bill Wood
  16. I am using VW2008 PC and am trying to write a wrapper script to menu command 'Import Single DXF/DWG File' I am not having much luck. The VS Reference suggests using a selector 'Import DXF/DWG' but when I try using both of the above as menu command selectors in Domenutextbyname I get an error - code shown below >>>> Error: TEST DOMENUTEXTBYNAME - Menu cannot be found. Import Single DXF/DWG File >>>> The menu entry does exist in the current workspace procedure test; begin domenutextbyname('Import Single DXF/DWG File',0); end; run(test); Any ideas? While I am at it the 'Export DXF/DWG' also doesnt work - again any ideas? Thanks in advance Bill Wood
  17. I have dug out some code I use to check if inside a group or viewport. Regards Bill Wood function checkstatus : BOOLEAN; Var objty : INTEGER; btest : BOOLEAN; begin locus(0,0); objty := gettype(getparent(Lnewobj)); delobject(Lnewobj); btest := (objty = 31); {Layer} if NOT btest then alrtdialog('Exit current editing mode first'); checkstatus := btest; end;
  18. 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?
  19. 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);
  20. 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);
  21. I occasionally get a Runtime Error running a rather large script. VW pops up a dialog saying >>>>>>>>>>>> This application has requested the Runtime to terminate it in an unusual way. Please contact the application,s support team for more information. >>>>>>>>>>>> which is not very helpful in tracking down any problems. My question is do any guys at NNA know of any circumstances where scripts do terminate VW. I suspect passing 0 to an array in a structure may do this. Any other nuggets of information on this topic would be gratefully received. Thanks Bill Wood
  22. Rick, rsAvailable is a BOOLEAN signifying if the resource file was successfully loaded. I have now changed my tack and use checkboxes to swap the content of image controls. However, it still would be nice to have an event on clicking an image control. PS the code framework was hacked from an NNA example.
  23. I am trying to write a visual editor for rooflight placement. I was hoping to toggle the image associated with an image control (ie rooflight or standard sheet) but the clicking of an image control does not fire an event. The images are 50x75 pixels. NNA, is this by design or a bug and is it likely to be fixed? Alternatively am I doing something wrong. My test code is below. Thanks Bill Wood PC VW 11.01 PROCEDURE ImageTest; VAR gDlogID,gDlogResult : INTEGER; gOKdlog,rsAvailable : BOOLEAN; FUNCTION Define_Dialog: INTEGER; VAR dialogID,i : INTEGER; BEGIN dialogID := CreateLayout('Rooflight Editor',True,'OK','Cancel'); CreateStaticText(dialogID,4,'Set Rooflight:',-1); CreateControl(dialogID,5,1,'',1010); CreateControl(dialogID,6,1,'',1010); CreateControl(dialogID,7,1,'',1010); CreateControl(dialogID,8,1,'',1010); CreateControl(dialogID,9,1,'',1011); CreateControl(dialogID,10,1,'',1010); CreateControl(dialogID,11,1,'',1010); CreateControl(dialogID,12,1,'',1010); CreateControl(dialogID,13,1,'',1010); SetFirstLayoutItem(dialogID,4); SetBelowItem(dialogID,4,5,0,0); SetRightItem(dialogID,5,6,-2,0); SetRightItem(dialogID,6,7,-2,0); SetBelowItem(dialogID,5,8,0,-2); SetRightItem(dialogID,8,9,-2,0); SetRightItem(dialogID,9,10,-2,0); SetBelowItem(dialogID,8,11,0,-2); SetRightItem(dialogID,11,12,-2,0); SetRightItem(dialogID,12,13,-2,0); Define_Dialog := dialogID; END; PROCEDURE Drive_Dialog(VAR item:LONGINT; data:LONGINT); VAR temp_i,i:INTEGER; temp_s:STRING; result:BOOLEAN; BEGIN CASE item OF 5,6,7,8,9,10,11,12,13: alrtdialog('image hit'); END;{of CASE} END; BEGIN {MAIN} rsAvailable:= SetVSResourceFile('C:\Program Files\VectorWorks 11\images'); gDlogID := Define_Dialog; gOKdlog := VerifyLayout(gDlogID); IF gOKdlog THEN gDlogResult := RunLayoutDialog(gDlogID,Drive_Dialog); END; Run(ImageTest);
  24. Thanks for the comments. I dont think its a good idea to change views within a plugin objects code. I created the path object as a nurbs curve in it's correct register and it worked, even with a 2D polyline for the profile. However, the results were NOT always correct in my PIO. I am writing a PIO to generate a cranked crown roof sheet with a corrugated profile. The apex has a curve which always has a 300mm radius, with the curve length varying with the pitch of roof. Interestingly a roof pitch of 22.5 shows a reversed profile while 22.6 shows the profile in the correct orientation. Similarly 4.9 works 5 fails. The profile depth does not exceed the curve radius which may have been one reason. There doesnt seem much logic. Has anyone had any similar experiences with flipped profiles Bill Wood
  25. Are there any code examples of using CreateExtrudeAlongPath in a plugin object (in my case a Piont Plugin object) ie. robjH := CreateExtrudeAlongPath(pathH,profH); I am creating a polyline for the profile object and a polyline converted to a Nurbs object for the pathH. The problem is that the result differs when the screen view is different. I suspect it is because the convert to Nurbs is done in relation to the screen view AND OR the profile 2D object is converted in screen view. Does this mean I have to generate the path and profile object directly as Nurbs objects and in the correct 3D register? Any help would be much appreciated. Bill Wood
×
×
  • Create New...