Jump to content
GGC

Newbie Repeat Dialog Value ForEachObject inquiry

Recommended Posts

I have been attempting to complete a simple VS dialog input for the CallOut PIO text margin based on Page Units.

So far, i was successful to repeat the dialog for each of the selected PIO.   I have researched extensively how to pass 

the dialog value input (once inputed) for each PIO selected, however I could find the appropriate answer at least for

my VS newbie lexicon.

 

I am attempting to pass the Dialog Value inputed once to the Procedure to repeat for each selected PIO.

 

Could anybody share a bit of VS wisdom about how to pass the Dialog Value inputed once to repeat ForEachObject?

 

Initial VS that obviously requests a dialog input for each selected PIO:

--------------------------------------------------------------------------------------------------------------------
Procedure SomeCalloutMrgnDialog;

Var    
    H1:Handle;
    B1:Boolean;
    MrgnCall, MrgnValue,LyrScale:Real;
    MrgnValueStrng,default,request:String;


Procedure SetObj_Value(H1:Handle);

Begin
    
    request:='CallOut PIO Page Unit Margin';

    default:='0.0625';

    MrgnCall:=DistDialog(request,default);
        
    H1:=FSActLayer;
    
    LyrScale:=GetLScale(ActLayer);

    MrgnValue:=LyrScale*MrgnCall;
    
    MrgnValueStrng:=Concat(MrgnValue);
    
    SetRField(H1,'Callout','Margin',MrgnValueStrng);
    
    ResetObject(H1);
    
    SetDSelect(H1);
    
    End;
Begin
    ForEachObject(SetObj_Value,(((VSEL=TRUE) & (PON='Callout'))));
    
    DoMenuTextByName('Previous Selection',0);
    
End;


Run(SomeCalloutMrgnDialog);

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

After my extensive research an attempted VS to repeat the Dialog Value for each object.  Though, after I input the value once

for more than one selected PIO nothing happens.

 

Procedure SomeCalloutMrgnDialog;

Var    
    H1:Handle;
    B1:Boolean;
    MrgnCall, MrgnValue,LyrScale:Real;
    MrgnValueStrng,default,request:String;

Begin
    
    request:='CallOut PIO Page Unit Margin';

    default:='0.0625';
    
    MrgnCall:=DistDialog(request,default);
    
    LyrScale:=GetLScale(ActLayer);

    MrgnValue:=LyrScale*MrgnCall;
    
    MrgnValueStrng:=Concat(MrgnValue);
End;

Procedure SetObj_Value(H1:Handle);

Var

MrgnValueStrng: String;

Begin
    
    SetRField(H1,'Callout','Margin',MrgnValueStrng);
    
    ResetObject(H1);
    
    SetDSelect(H1);
    
    End;
    
Procedure Last_Step_Proc;
Begin
    
    ForEachObject(SetObj_Value,(((VSEL=TRUE) & (PON='Callout'))));

    DoMenuTextByName('Previous Selection',0);
    
End;
Run(SomeCalloutMrgnDialog);

 

Share this post


Link to post

Try this slight variation (untested):

 

Procedure SomeCalloutMrgnDialog;
Var    
    H1:Handle;
    B1:Boolean;
    MrgnCall, MrgnValue,LyrScale:Real;
    MrgnValueStrng,default,request:String;

Procedure GetValues;
Begin
    
    request:='CallOut PIO Page Unit Margin';
    default:='0.0625';
    
    MrgnCall:=DistDialog(request,default);
    
    LyrScale:=GetLScale(ActLayer);
    MrgnValue:=LyrScale*MrgnCall;
    
    MrgnValueStrng:=Concat(MrgnValue);
End;

Procedure SetObj_Value(H1:Handle);
Begin
    
    SetRField(H1,'Callout','Margin',MrgnValueStrng);
    
    ResetObject(H1);
    
    SetDSelect(H1);
    
End;
    

Begin
    GetValues;
    ForEachObject(SetObj_Value,(((VSEL=TRUE) & (PON='Callout'))));
    DoMenuTextByName('Previous Selection',0);
    
End;
Run(SomeCalloutMrgnDialog);

Share this post


Link to post

Thank you Julian, your revision works.

I appreciate you taking the time to revise my newbie attempt.

 

 

Share this post


Link to post

I have been attempting to further revise the script to work inside groupts, symbols, and viewport annotations.

Though I used the GetParent to obtain a handle of the container (group, symbol, or viewport) for GetLayer to use for GetLScale

the factor that I need to use for page units the script will find the CallOut PIO however not the the handle for the layer thus

GetLScale=0, thus obviously the text margin set will become 0 (zero) for CallOut PIOs in groups, symbols, or viewports.  

I have researched in the forums and noticed that for some reason VS needs a handle for each specific container condition other

than design layers, that is a quite a puzzle.

 

Could anybody share a thought if there is the possibility to obtain a handle for each CallOut PIO regardless of the container or not to use for GetLscale(GetLayer(GetParent(CalloutPIOhandle).

 

Procedure SomeDialogValue;

Var    
    H1:Handle;
    LyrScale, MrgnCall, MrgnValue :Real;
    Default, Request, MrgnValueStrng : String;


Procedure GetValues;
Begin
            
    Request := 'CallOut PIO Page Unit Text Margin';
    Default:= '0.03125';
    
    MrgnCall := DistDialog(request,default);
    
    If NOT DidCancel Then BEGIN
    End;
    End;
    
Procedure Callback(H1 :Handle);
Begin
    
    MrgnCall := MrgnCall;

    LyrScale := GetLScale(GetParent(H1));
    
    MrgnValue:= LyrScale*MrgnCall;
    
    MrgnValueStrng := Concat(MrgnValue);
    
    SetRField(H1,'Callout','Margin',MrgnValueStrng);
    
    ResetObject(H1);
    
    SetDSelect(H1);
End;

Begin
    If NOT DidCancel Then GetValues;
    If NOT DidCancel Then ForEachObject(Callback, ((INSYMBOL & INOBJECT & INVIEWPORT & (PON='Callout') & (('Callout'.'Bubble Style'='None')|('Callout'.'Bubble Style'='Vertical Accent Bar')))));
End;
Run(SomeDialogValue);

Share this post


Link to post

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.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...