Jump to content

maarten.

Member
  • Posts

    387
  • Joined

  • Last visited

Everything posted by maarten.

  1. =Opp is the Dutch translation of the =Area function (i think it's =Area in English, not sure though).
  2. FUNCTION Get3DOrientation(h :HANDLE; VAR xRot, yRot, zRot :REAL; VAR isMirroredXY :BOOLEAN) :BOOLEAN; I used this one a while ago, and it did the trick.
  3. Sorry, i made some mistakes: While debugging i saw that the script only saved the name of the first selected layer. So i was wrong in mine above statement that posSel should be 1... Sorry, you were right! In the sorting the array part, WinQ wasn't sorted, so you got the wrong quantity with the symbols. I can't seem to be able to duplicate that same scenario here cause it counted the correct number of symbols (except for the above faults then). Can you try this code again and see of it works? It works here. {Maarten Vandickelen and others 2008} PROCEDURE Layerlist; VAR winH : DYNARRAY of HANDLE; WinL : DYNARRAY of REAL; WinN : DYNARRAY of STRING; WinQ : DYNARRAY of LONGINT; DynWahlLayer : DYNARRAY OF STRING; total : INTEGER; count, counter : INTEGER; tmpS,sytext,gName,vargName : STRING; tmpCount, posSel, position : INTEGER; cnt1,cnt2 : INTEGER; tmpR : REAL; tmpH, Latemp : HANDLE; tmpL : LONGINT; tmpI : INTEGER; pt1,pt2 : POINT; ptN1,ptN2 : POINT; id : LONGINT; Layerliste : INTEGER; varLName, WahlLayer : STRING; {--------------------------------------------------------------------------------------------------} PROCEDURE Dialog; VAR id : INTEGER; Dialogresult : INTEGER; PROCEDURE Define_NameDialog; BEGIN id := CreateResizableLayout('List',TRUE,'OK','Cancel',TRUE,TRUE); { define the controls for the dialog } CreateStaticText(id,4,'Symbolname contains:',-1); CreateEditText(id,5,'window',26); CreateStaticText(id,6,'Select Layers',-1); CreateListBoxN(id,7,33,13,True); { perform the dialog layout } SetFirstLayoutItem(id,4); SetRightItem(id,4,5,0,0); SetBelowItem(id,5,6,0,0); SetBelowItem(id,6,7,0,0); { perform final control alignment and adjustment AlignItemEdge(id,4,1,1001,0); SetEdgeBinding (id,6,FALSE,FALSE,TRUE,FALSE); SetEdgeBinding (id,7,TRUE,TRUE,TRUE,TRUE); { create help text for controls } SetHelpString(1,'List'); SetHelpString(2,'Cancel the operation and exit.'); SetHelpString(4,'Symbolname contains string.'); SetHelpString(5,'Symbolname contains string.'); SetHelpString(7,'STRG + click'); END; {--------------------------------------------------------------------------------------------------} PROCEDURE Drive_NameDialog (Var item,data : LONGINT); PROCEDURE Dialogsettings; PROCEDURE Layerlistfilling(Layerliste:INTEGER); VAR I : INTEGER; LayerName : STRING; LayerHand : HANDLE; id : LONGINT; LayerZahl : DYNARRAY OF STRING; BEGIN ALLOCATE Layerzahl[1..NumLayers]; LayerHand := FLayer; I := 1; LayerZahl[i] := GetLName(layerHand); REPEAT LayerHand := NextObj(LayerHand); I := I+1; LayerZahl[i] := GetLName(layerHand); UNTIL I = NumLayers; SortArray(LayerZahl,NumLayers,1); FOR I := 1 TO NumLayers DO InsertChoice(7,NumChoices(7),LayerZahl[i]); END; BEGIN Layerlistfilling(Layerliste); END; {--------------------------------------------------------------------------------------------------} PROCEDURE SetInfo(h : HANDLE); VAR laycnt : INTEGER; cnt : INTEGER; bool : BOOLEAN; BEGIN FOR laycnt:=1 TO NumLayers DO IF GetLName(GetLayer(h))=DynWahlLayer[laycnt] THEN BEGIN IF total>0 THEN FOR cnt:=1 TO total DO IF GetSymName(h)=WinN[cnt] THEN BEGIN bool:=TRUE; WinQ[cnt]:=WinQ[cnt]+1; END; IF NOT bool THEN BEGIN total:=total+1; ALLOCATE winH[1..total]; ALLOCATE winL[1..total]; ALLOCATE winN[1..total]; ALLOCATE winQ[1..total]; winH[total]:=h; GetBBox(h,pt1.x,pt1.y,pt2.x,pt2.y); WinL[total]:=pt2.x-pt1.x; WinN[total]:=GetSymName(h); WinQ[total]:=1; END; END; END; {--------------------------------------------------------------------------------------------------} PROCEDURE HANDLEOK; BEGIN ALLOCATE DynWahlLayer[1..NumLayers]; counter := 0; posSel := 0; REPEAT GetSelChoice(7,posSel,position,DynWahlLayer[counter+1]); counter := counter+1; posSel := position+1; UNTIL (counter>posSel); gName := GetField(5); vargName:=concat('S=',CHR(39),'*',gName,'*',CHR(39)); ForEachObject(SetInfo,vargName); IF total<>0 THEN BEGIN {create new layer} tmpS:='New_Layer'; IF GetObject(tmpS)<>NIL THEN BEGIN REPEAT tmpCount:=tmpCount+1; IF GetObject(ConCat(tmpS,Num2Str(0,tmpCount)))=NIL THEN tmpS:=ConCat(tmpS,Num2Str(0,tmpCount)); UNTIL(GetObject(tmpS)=NIL); END; Layer(tmpS); SetLScale(ActLayer, 50); DoMenuTextByName('Standard Views',1); {sort symbols by length} FOR cnt1:=1 TO total DO BEGIN FOR cnt2:=1 TO total-cnt1 DO BEGIN IF WinL[cnt2]>WinL[cnt2+1] THEN BEGIN tmpH:=WinH[cnt2]; tmpR:=WinL[cnt2]; tmpS:=WinN[cnt2]; tmpI:=WinQ[cnt2]; WinH[cnt2]:=WinH[cnt2+1]; WinL[cnt2]:=WinL[cnt2+1]; WinN[cnt2]:=WinN[cnt2+1]; WinQ[cnt2]:=WinQ[cnt2+1]; WinH[cnt2+1]:=tmpH; WinL[cnt2+1]:=tmpR; WinN[cnt2+1]:=tmpS; WinQ[cnt2+1]:=tmpI; END; END; END; {place symbol} FOR count:=1 TO total DO BEGIN IF count=1 THEN BEGIN Symbol(winN[count],0,0,0); GetBBox(LNewObj,pt1.x,pt1.y,pt2.x,pt2.y); MoveTo(0,pt2.y-20cm); CreateText(Concat(Num2Str(0,WinQ[count]),' St?ck ',CHR(13),WinN[count])); SetTextJust(LNewObj,1); END ELSE BEGIN GetBBox(LNewObj,pt1.x,pt1.y,pt2.x,pt2.y); Symbol(WinN[count],0,0,0); GetBBox(LNewObj,ptN1.x,ptN1.y,ptN2.x,ptN2.y); {move this symbol 100cm over the last symbol} HMove(LNewObj,pt2.x-ptN1.x+100cm,0); {write the quantity and name under the symbol} MoveTo(pt2.x-ptN1.x+100cm,ptN2.y-20 cm); CreateText(Concat(Num2Str(0,WinQ[count]),' St?ck ',CHR(13),WinN[count])); SetTextJust(LNewObj,1); END; END; DoMenuTextByName('Standard Views',3); SetLayerRenderMode(ActLayer,6,true,false); END; END; {--------------------------------------------------------------------------------------------------} PROCEDURE HANDLEBAD; BEGIN END; BEGIN CASE item OF SetupDialogC: Dialogsettings; 1 : HANDLEOK; 2 : HANDLEBAD; END; END; BEGIN Define_NameDialog; IF VerifyLayout(id) THEN Dialogresult:=RunLayoutDialog(id,Drive_NameDialog); END; BEGIN Dialog; END; RUN(Layerlist);
  4. Can you try this one? I'm not sure, but i think this is the problem PROCEDURE HANDLEOK; BEGIN ALLOCATE DynWahlLayer[1..NumLayers]; counter := 1; posSel := 1; GetSelChoice(7,posSel,position,DynWahlLayer[counter]); Because posSel was 0, you also got the first item in the list. Also, i started the counter (and allocation) at 1 in stead of zero. Otherwise, the REPEAT did one extra loop because UNTIL (counter>position); wasn't correct in this case. PROCEDURE SetInfo(h : HANDLE); VAR laycnt : INTEGER; cnt : INTEGER; bool : BOOLEAN; BEGIN FOR laycnt:=1 TO NumLayers DO IF GetLName(GetLayer(h))=DynWahlLayer[laycnt] THEN Again, i'm not completly sure, it's still a little early to think clear :grin: .
  5. Problem is that you can not open a file if the file is already openend by an other user, doesn't matter what permission the OS gives to the file. So instead of getting the "failled on atempt to open file" in VW, you should get "this file is already in use, the file will be read-only". You could ad this to the wish-list. EDIT: didn't see Christiaan's post.
  6. There were a few faults in it. The first was that the Variable zaehler wasn't named under VAR. Also zaehler didn't had any content so therefor you made a loop in the REPEAT...UNTIL (zaehler>position); and you looked in the array with index zero, and that doesn't excist. An other thing that doesn't work: (L IN [',DynWahlLayer[zaehler],'])... If zaehler would had a content, (for example 2) you would only get the information of the symbols that are on the second selected layer, so all the other layers that you selected would be ignored and that isn't the purpose i asume. Here's the code again, i just took a few tests, so maybe there are still some faults in it... Only the SetInfo and HANDLEOK Procedures are changed cause the rest seemed OK. As you can see in the ALLOCATE DynWahlLayer[0..NumLayers]; and FOR laycnt:=1 TO NumLayers lines, the Dynarray gets allocated to wide (the number of layers in the document). I only need the number of selected layers, but i have no idea how you can get that (haven't searched for it either (sorry, little lazy :blush: ) maybe you or somebody else knows the answer?). Anyway, this works too, but would ask (a little) more performance of your computer. {--------------------------------------------------------------------------------------------------} PROCEDURE SetInfo(h : HANDLE); VAR laycnt : INTEGER; cnt : INTEGER; bool : BOOLEAN; BEGIN FOR laycnt:=1 TO NumLayers DO IF GetLName(GetLayer(h))=DynWahlLayer[laycnt] THEN BEGIN IF total>0 THEN FOR cnt:=1 TO total DO IF GetSymName(h)=WinN[cnt] THEN BEGIN bool:=TRUE; WinQ[cnt]:=WinQ[cnt]+1; END; IF NOT bool THEN BEGIN total:=total+1; ALLOCATE winH[1..total]; ALLOCATE winL[1..total]; ALLOCATE winN[1..total]; ALLOCATE winQ[1..total]; winH[total]:=h; GetBBox(h,pt1.x,pt1.y,pt2.x,pt2.y); WinL[total]:=pt2.x-pt1.x; WinN[total]:=GetSymName(h); WinQ[total]:=1; END; END; END; {--------------------------------------------------------------------------------------------------} PROCEDURE HANDLEOK; BEGIN ALLOCATE DynWahlLayer[0..NumLayers]; counter := 0; posSel := 0; GetSelChoice(7,posSel,position,DynWahlLayer[counter]); REPEAT counter := counter+1; posSel := posSel+1; GetSelChoice(7,posSel,position,DynWahlLayer[counter]); UNTIL (counter>position); gName := GetField(5); vargName:=concat('S=',CHR(39),'*',gName,'*',CHR(39)); ForEachObject(SetInfo,vargName); IF total<>0 THEN
  7. Can you post the whole script, cause i have no idea what you're doing. I'll be out house the whole day but i can look at it in the evening.
  8. Maybe you can leave the (L IN [',DynWahlLayer[counter],'])' out of the criteria and see in your SetInfo Procedure if the object is in one of the layers. IF they are, then get the required info of the object. Something like this: For counter:=1 TO totalLayers DO BEGIN IF GetLayer(h)= DynWahlLayer[counter] THEN BEGIN WinH[...]:=h; Win.... END; END;
  9. While holding down ctrl and clicking on the requared lines, you should be able to select them. If i remember wel, it's the same on Windows.
  10. You can select multiple lines in a ListBoxN (a snap of a dialog with a list of the classes): A listbrowser should work too, but is to complex in this case cause you can also adjust the visibility and such of the layers and you don't need that (i think )...
  11. What is it exactly that doesn't work? Here's a piece of a script of mine that will fill your ListBox. The id of the ListBox is 2000 in this example. PROCEDURE Dialooginstellingen; VAR tel : INTEGER; h : HANDLE; BEGIN h:=FLayer; FOR tel:=1 TO NumLayers DO BEGIN InsertChoice(2000,NumChoices(2000),GetLName(h)); h:=NextLayer(h); END; END;
  12. You need to put your code between these tags [ code ][ /code ] (but then without the spaces) You get these by clicking on this symbol # in the little bar at the top of the Textbox while selecting your code.
  13. Graag gedaan I see now that i forgot something: INGROUP should also be part of the Criteria, so you 'll get: INSYMBOL & INGROUP & (T=Rect)
  14. PROCEDURE Example; PROCEDURE SetLineWight(h : HANDLE); BEGIN SetLW(h,1); END; BEGIN ForEachObject(SetLineWight,INSYMBOL & (T=Rect)); RedrawAll; END; RUN(Example); This script selects all the rectangles ((T=Rect)), also the ones in symbols (INSYMBOL) and changes the linewight (SetLW(h,1)).
  15. Yes, with a simple ForEachObject script you can do what you ask. For more info, you better start a topic in the VectorScript part of this board.
  16. I doubt that, as far as i know, the distributors can only translate the pio's parameters and dialogs, they can not change any of the code because it's locked.
  17. I think it's a corrupt workspace. You can try to make a new one (or copy the one from your colleage).
  18. Not sure if i understand what you're talking about, but here in Belgium, we use a dotted line for inward and a solid line for outwards in frontview. I'm pretty sure that that's a universal standard.
  19. The problem is that the bitmap is a fixed 'rectangle', so it will always have square corners. If the bitmap has an other rotation then 0? or 90?, it will not scale. Same thing goes for the new rectangles (2008), you can't scale them either when they are rotated. BTW, i think that the lines SetSelect(photo); and group; aren't necessary.
  20. HScale2D does work too, but you need to refresh your screen to see it. HScale2D(FSActLayer,0,0,2,2,TRUE); RedrawAll; (you can use other things then RedrawAll that asks less performance of your computer, but i can't think of one right now, sorry...)
  21. That does work indeed. Thanks for the tip Pat . Haha, awesome, i learn something new every day .
  22. Scale Works fine here. Be sure that the bitmap is selected (if not, you can use SetSelect).
  23. Well, i have a Variable that has the same name as a Function... That isn't that smart of course. So Paul, i thinks it's better to replace the Variable count by an other name (counter for example). (that's one of the reasons why i give my Variables a Dutch name ) But still, it seems that Count(S=a variable) doesn't work...
  24. Very odd, normally this would do it: CreateText(Concat(Num2Str(0,Count(S=WinN[count])),' : ',WinN[count])); But for some reason it doesn't work... Seems like Count(S=WinN[count]) doesn't work, no idea why :confused: . Okay, an other (but longer) way to do this: PROCEDURE WindowsToLayer; VAR winH : DYNARRAY of HANDLE; WinL : DYNARRAY of REAL; WinN : DYNARRAY of STRING; WinQ : DYNARRAY of LONGINT; total : INTEGER; count : INTEGER; tmpS : STRING; tmpCount : INTEGER; cnt1,cnt2 : INTEGER; tmpR : REAL; tmpH : HANDLE; tmpL : LONGINT; pt1,pt2 : POINT; ptN1,ptN2 : POINT; PROCEDURE SetInfo(h : HANDLE); VAR cnt : INTEGER; bool : BOOLEAN; BEGIN IF total>0 THEN FOR cnt:=1 TO total DO IF GetSymName(h)=WinN[cnt] THEN BEGIN bool:=TRUE; WinQ[cnt]:=WinQ[cnt]+1; END; IF NOT bool THEN BEGIN total:=total+1; ALLOCATE winH[1..total]; ALLOCATE winL[1..total]; ALLOCATE winN[1..total]; ALLOCATE winQ[1..total]; winH[total]:=h; GetBBox(h,pt1.x,pt1.y,pt2.x,pt2.y); WinL[total]:=pt2.x-pt1.x; WinN[total]:=GetSymName(h); WinQ[total]:=1; END; END; BEGIN ForEachObject(SetInfo,S='*window*'); IF total<>0 THEN BEGIN {create new layer} tmpS:='New Layer'; IF GetObject(tmpS)<>NIL THEN BEGIN REPEAT tmpCount:=tmpCount+1; IF GetObject(ConCat(tmpS,Num2Str(0,tmpCount)))=NIL THEN tmpS:=ConCat(tmpS,Num2Str(0,tmpCount)); UNTIL(GetObject(tmpS)=NIL); END; Layer(tmpS); {sort symbols by length} FOR cnt1:=1 TO total DO BEGIN FOR cnt2:=1 TO total-cnt1 DO BEGIN IF WinL[cnt2]>WinL[cnt2+1] THEN BEGIN tmpH:=WinH[cnt2]; tmpR:=WinL[cnt2]; tmpS:=WinN[cnt2]; tmpL:=WinQ[cnt2]; WinH[cnt2]:=WinH[cnt2+1]; WinL[cnt2]:=WinL[cnt2+1]; WinN[cnt2]:=WinN[cnt2+1]; WinQ[cnt2]:=WinQ[cnt2+1]; WinH[cnt2+1]:=tmpH; WinL[cnt2+1]:=tmpR; WinN[cnt2+1]:=tmpS; WinQ[cnt2+1]:=tmpL; END; END; END; {place symbol} FOR count:=1 TO total DO BEGIN IF count=1 THEN BEGIN Symbol(winN[count],0,0,0); GetBBox(LNewObj,pt1.x,pt1.y,pt2.x,pt2.y); MoveTo(0,pt2.y); CreateText(Concat(Num2Str(0,WinQ[count]),' : ',WinN[count])); SetTextJust(LNewObj,2); END ELSE BEGIN GetBBox(LNewObj,pt1.x,pt1.y,pt2.x,pt2.y); Symbol(WinN[count],0,0,0); GetBBox(LNewObj,ptN1.x,ptN1.y,ptN2.x,ptN2.y); {move this symbol 50cm over the last symbol} HMove(LNewObj,pt2.x-ptN1.x+50cm,0); {write the quantity and name under the symbol} MoveTo(pt2.x-ptN1.x+50cm,ptN2.y); CreateText(Concat(Num2Str(0,WinQ[count]),' : ',WinN[count])); SetTextJust(LNewObj,2); END; END; END; {$debug} END; RUN(WindowsToLayer);
×
×
  • Create New...