Jump to content

VvierA

Member
  • Posts

    182
  • Joined

  • Last visited

Posts posted by VvierA

  1. Hello,

    I made a PIO with a symbol inside.

    When I activate the PIO in the drawing there is ONE modification point so that the symbol can be moved individually and independently from the PIO itself.

    That's nice, but I'd like to have more modification points around the symbol, i.e. a bounding box or something like that.

    Can anybody give me a hint in which direction to research?

    VvierA

  2. Ok thank you. I programmed a loop and checked the types of the parents.

    If it's a viewport I get the scale with GetObjectVariableReal(hVP, 1003).

    But how do I get the scale of the Layer where the PIO is nested?

    May I use Act_Scale := GetLScale (ActLayer);

    if I determinded that the upper most parent is a layer or is there another way to get the scale of the layer (for example another Object Variable)?

  3. Still desperate. I tested every thing I imagined but no help.

    I'm still looking to get the position of an PIO in relation to the internal origin or rather in relation to the underlying design layer.

    So that the position remains the same, even if the viewport is moved.

    Alternatively I am trying to get the position of a viewport in relation to the internal origin. So I could calculate the position of my PIO in relation to the internal origin.

    Any help?

    VvierA

  4. So everything works fine with my new level dimension tool but I have a severe problem with viewport annotation on sheet layers.

    My auto level dimension tool gets the dimension by using:

    GetSymLoc(hParm, x, y);

    y is displayed as the level dimension.

    The problem with viewport annotation on sheet layers is, that "GetSymLoc(hParm, x, y);" doesn't get the y-coordinate of the underlying design layer BUT of the sheet layer.

    So for example if I move my viewport an my sheet layer to rearrange my layout every level dimension will change.

    Is there any chance to 'access' the coordinate system of the underlying design layer from within a viewport annotation?

    Any help appreciated

    VvierA

  5. Hello again,

    with your kind help I managed to get my plugin working but now there is the next challenge as mentioned in my earlier post:

    I have a plugin object that may be uses within a layer oder within a viewport annotation.

    How can I check wether the PIO is inside a layer or inside a viewport annotation and how can I retrieve the scale of the viewport? (the scale of a layer is not so difficult I think)

    Kind regards

    VvierA

  6. Hi there,

    I try to program a auto level dimension tool and I am using a linear plug-in object to do that. It draws a small triangle with some text showing the y-coordinate of the PIO.

    The linear plug-in object ist defined (of course) by two mouse clicks.

    If the first mouse click is more on the left than the second click everything works feine.

    But: if the second click is more to the left everything becomes flipped so that the text and the small triangle are turned upside down. The angle indicator in the small object info palette shows 180?.

    That's not intended. I like the POI behave exactly the same no matter if it is drawn from left to right or vise versa.

    Can anybody help?

    Maybe I should check if the x-coordinate of the first click is lower than the second? But how could I do that? How could I retrieve the x an y coordinates of the first and the second click of a linear object?

    Or is there an easier way to prevent the POI from getting flipped over?

    Thank you for help

    kind regards

    VvierA

  7. Solved it with the help of Vectorlab (www.vectorlab.info).

    I found two subroutines to replace the FSActLayer.

    The subroutines work in both the construction layer and inside the annotations of a design layer viewport.

    I admit - I do not understand them completely but that's ok.

    VvierA

    FUNCTION H_ActContainer: HANDLE;

    BEGIN BeginContext;

    Locus(0, 0);

    H_ActContainer := GetParent(LNewObj);

    DelObject(LNewObj);

    EndContext(0);

    END;

    FUNCTION H_FSActContainer: HANDLE;

    VAR h : HANDLE;

    BEGIN h := FIn3D(H_ActContainer);

    WHILE (h <> NIL) & (Selected(h) = FALSE) DO

    IF Selected(h) THEN

    H_FSActContainer := h

    ELSE

    h := NextObj(h);

    H_FSActContainer := h;

    END;

  8. Thank you Josh.

    I tried to investigate, following your hints but I failed.

    As I understand I need a replacement for "FSActLayer" because this seems to return NIL if I select something inside a Design Layer viewport.

    Does anybody know a replacement for FSActLayer that works inside a Design Layer viewport?

    And does anybody know a routine to check if I'm inside a Design Layer viewport or not so that the script uses either FSActLayer or the 'other' command that works inside the viewport?

    Kind regards

    VvierA

  9. Hello everybody,

    I wrote a small Vectorscript that converts polygons to a custom path object (another plugin I made with the kind help of the members of this forum).

    The Vectorscript works perfectly with 2012 and it works with 2013 in the construction layer but it fails to work within the 'Annotations' of a sheet layer.

    Has anybody an idea? Any help or hint is kindly appreciated...

    ----------------------------------

    PROCEDURE allesstempelkonverter;

    VAR

    objectH, newobjH :HANDLE;

    SObjectHandle :DYNARRAY [] OF HANDLE;

    numsel, zaehl :INTEGER;

    {in der ersten Schleife werden Handles zu allen gew?hlten Objekten verteilt}

    BEGIN

    objectH := FSActLayer;

    numsel := Count((SEL=TRUE));

    ALLOCATE SObjectHandle[1..numsel];

    zaehl := 1;

    WHILE (objectH <> NIL) DO BEGIN

    SObjectHandle[zaehl] := objectH;

    zaehl := zaehl+1;

    objectH := NextSObj(objectH);

    END;

    {message (numsel,' Z?hler ',zaehl);}

    {in der zweiten Schleife werden die Objekte umgewandelt}

    zaehl := 1;

    WHILE zaehl <= numsel DO BEGIN

    IF (GetType(SObjectHandle[zaehl]) = 3) OR {Pr?fung ob es ein Rectangle ist}

    (GetType(SObjectHandle[zaehl]) = 4) OR {Oval}

    (GetType(SObjectHandle[zaehl]) = 5) OR {Polygon}

    (GetType(SObjectHandle[zaehl]) = 6) OR {Bogen bzw. Kreis}

    (GetType(SObjectHandle[zaehl]) = 21) THEN BEGIN {Polyline}

    { SetPenFore(SObjectHandle[zaehl],45);}

    newobjH := CreateCustomObjectPath('db Allesstempel', SObjectHandle[zaehl], nil);

    END;

    zaehl := zaehl+1;

    END;

    END;

    run(allesstempelkonverter);

    ----------------------------------

  10. Thank you very much.

    Although I made the script earlier (with lots of help from you) I am still a beginner and do not know how to create an event loop or call the ResetObject function.

    Do you know some sort of sample or reference code so maybe I can adapt it for my purposes? That would be really great.

    But anyway - thank you very much for your help so far.

    VvierA

  11. Maybe I found a hint how to solve the problem.

    It seems to me, that recalculating the PIO makes the room stamp reappear.

    It's a workaround to invoke the recalculation by editing the polyline of the PIO or editing a parameter. But that's annoying.

    I checked the options "Recalculate by event, by movement and by rotation" in the PIO options dialog but VW does not recognize the movement of the view area as a movement that invokes the recalculation.

    Is there a script to force all placed PIOs to recalculate. So I don't have to do it manually?

  12. Hello,

    I programmed a custom made "space" tool. It's a 2D path object.

    It's a room stamp and it retrieves the area (and perimeter) of the 2D path and writes it into a database. The space tool then places a room stamp symbol that is linked to the database.

    The strange thing is:

    If I use the space tool in the view area of a sheet layer everything is ok first.

    But if I move the view area on the sheet all the placed room stamps disappear.

    I can make them reappear by selecting and editing the polyline.

    Is there a bug in my script or is it a VW problem?

    Can anybody help?

    Thank you

    kind regards

    VvierA

    Script (you need a database called "db_raumdaten" and the fields "raumflaeche" and "raumumfang". You also need a symbol that is linked to the database fields and the symbol needs to be selected as a parameter of the PIO)

    PROCEDURE dballesstempel;

    CONST

    kObjXPropSpecialEdit = 3; {das erste Konstantenpaket dient dem 'event enabler' gem. http://techboard.vectorworks.net/ubbthreads.php?ubb=showflat&Number=176863#Post176863}

    kReshapeSpecialEdit = 3;

    kObjXIs2DSurfaceEligible = 14;

    kObjXPropEditGroup = 1;

    kObjXPropEditGroupPath = 2;

    kObjOnInitXProperties = 5;

    kResetEventID = 3;

    feldSTRflaeche = 'raumflaeche';

    feldSTRumfang = 'raumumfang';

    datenbankSTR = 'db_raumdaten';

    VAR

    theEvent, theButton :LONGINT;

    status :BOOLEAN;

    result :BOOLEAN;

    polyHand, objHand, recHand, wallHand, pathHand, dupeHand, symbHand, layerhandle :HANDLE;

    objName, symName, flaecheSTR, umfangSTR, par_raumbezeichnung, recordname, pioclass, flaeche_korrigSTR, rundungSTR :STRING;

    flaeche, umfang, flaeche_korrig, flaeche_korrekt, p1X,p1Y,p2X,p2Y,symbscale, layerscale: REAL;

    stempelpos :VECTOR;

    BEGIN

    vsoGetEventInfo(theEvent, theButton);

    CASE theEvent OF

    kObjOnInitXProperties:

    BEGIN

    status:=SetObjPropCharVS(kObjXPropSpecialEdit,Chr(kReshapeSpecialEdit));

    status:=SetObjPropVS(kObjXIs2DSurfaceEligible,TRUE);

    status:=SetObjPropCharVS(kObjXPropEditGroup,Chr(kObjXPropEditGroupPath));

    status:=vsoInsertAllParams;

    END;

    kResetEventID:

    {Hier beginnt der eigentlich Code f?r das Duplizieren des Polygons und das Einf?gen des Raumstempelsymbols}

    BEGIN

    IF GetCustomObjectInfo(objName, objHand, recHand, wallHand) THEN

    BEGIN

    pathHand := GetCustomObjectPath(objHand);

    pioclass := GetClass(objHand);

    dupeHand := CreateDuplicateObject(pathHand, objHand);

    SetClass(dupeHand,pioclass);

    SetPolyClosed(dupeHand, TRUE);

    stempelpos := GetPtInPoly(dupeHand); {Schwerpunkt des Polygons finden und in Vector speichern}

    flaeche := ObjAreaN(dupeHand); {Feststellung der Fl?che}

    flaeche_korrig := ppar_flaeche_korrig; {?bernahme des Korrekturwunschs aus den Parametern}

    flaeche_korrekt := flaeche+flaeche_korrig;

    umfang := HPerimN(dupeHand); {Feststellung des Umfangs}

    flaeche_korrigSTR := Num2Str(2,flaeche_korrig); {Korrekturfl?che wird in String umgewandelt, damit sie in die Datenbank gepatcht werden kann}

    flaecheSTR := Num2Str(-2,flaeche_korrekt);

    umfangSTR := Num2Str(2,umfang); {verwandelt Zahl in String - eine Voraussetzung zur Eintragung in die Datenbank}

    {Message('Fl?che ', flaeche, 'Fl?cheSTR', flaecheSTR);} {Kontrollausgabe der Fl?chen}

    symName :=ppar_symb; {?bernahme des Symbolnamens aus den Parametern}

    {symbol(symName, stempelpos.x, stempelpos.y,0);}

    IF ((pControlPoint01X=0) AND (pControlPoint01Y=0)) THEN {Ein manuelles Setzen der Kontrollpunkte auf 0 soll ein Reset der Position des Raumstempels in die Polygonmitte zur Folge haben}

    BEGIN

    {resultstatus := GetCustomObjectInfo(objectName, objectHand, recordHand, wallHand);}

    symbol(symName, stempelpos.x, stempelpos.y,ppar_dreh);

    symbHand := LNewObj;

    {HScale2D(symbHand, pControlPoint01X, pControlPoint01Y, ppar_scale, ppar_scale, TRUE);}

    recordname := GetName(recHand);

    SetRField(objHand,recordname,'ControlPoint01X',Num2Str(9,stempelpos.x));

    SetRField(objHand,recordname,'ControlPoint01Y',Num2Str(9,stempelpos.y));

    {Message('Objekthandle ',objHand,'recordname ',recordname,' Kontrollpunkt ', pControlPoint01X,' ', pControlPoint01Y,' ',stempelpos.x,' ',stempelpos.y);} {Kontrollausgabe der Symbolbreite}

    END

    ELSE BEGIN

    symbol(symName, pControlPoint01X, pControlPoint01Y,ppar_dreh);

    {symbHand := LNewObj;}

    {HScale2D(symbHand, pControlPoint01X, pControlPoint01Y, ppar_scale, ppar_scale, TRUE);}

    {SetSelect(LNewObj);}

    {Scale(ppar_scale,ppar_scale);}

    END;

    symbHand := LNewObj;

    layerHandle := ActLayer; {Handle f?r aktiven Layer abfragen}

    layerScale := GetLScale( layerHandle ); {Layer Scale abfragen}

    SetObjectVariableInt(symbHand,101,2); {Symbol auf symmetrische Skalierung setzen}

    symbscale := (ppar_scale*layerScale); {Ma?stab des Layers mit manueller Skalierung multiplizieren}

    SetObjectVariableReal(symbHand,102,symbscale);

    SetObjectVariableReal(symbHand,103,symbscale);

    {Message('Objekthandle ',symbHand,'symbscale ',symbscale);}

    {SetSelect(LNewObj);}

    {Scale(ppar_scale,ppar_scale);}

    {ScaleObjectN(symbHand,0,0,1,1);} {Symbol skalieren}

    {GetBBox(symbHand,p1X,p1Y,p2X,p2Y);} {Bounding Box des Symbols ermitteln}

    {Message('Koordinaten ', p1X,' ',p1Y,' ',p2X,' ',p2Y)}; {Kontrollausgabe der Symbolbreite}

    SetRField(symbHand, datenbankStr, feldSTRflaeche, flaecheSTR);

    SetRField(symbHand, datenbankStr, feldSTRumfang, umfangSTR);

    SetRField(symbHand, datenbankStr, 'raumnummer', ppar_raumnummer);

    SetRField(symbHand, datenbankStr, 'raumbezeichnung', ppar_raumbezeichnung);

    SetRField(symbHand, datenbankStr, 'bodenbelag', ppar_bodenbelag);

    SetRField(symbHand, datenbankStr, 'ukrd', ppar_ukrd);

    SetRField(symbHand, datenbankStr, 'ukfd', ppar_ukfd);

    SetRField(symbHand, datenbankStr, 'okffb', ppar_okffb);

    SetRField(symbHand, datenbankStr, 'okrfb', ppar_okrfb);

    SetRField(symbHand, datenbankStr, 'raumkategorie', ppar_raumkategorie);

    SetRField(symbHand, datenbankStr, 'raum_ehem', ppar_raum_ehem);

    SetRField(symbHand, datenbankStr, 'neu_bestand_umbau', ppar_modi);

    SetRField(symbHand, datenbankStr, 'flaeche_korrektur', flaeche_korrigSTR);

    END;

    END;

    END;

    END;

    Run(dballesstempel);

×
×
  • Create New...