Jump to content

sle7en7

Member
  • Posts

    173
  • Joined

  • Last visited

Posts posted by sle7en7

  1. YES! That script works to change the ChildSymbol's fields. The only thing I have to take care of is if I can make 2 ParentSymbols' have different values for a field and the ChildSymbol's will reflect those accordingly. Right now, when you run the code on a ParentSymbol and change the ChildSymbol's record field, then it alters the other ParentSymbols' ChildSymbol record value as well. It's tricky, and you do expect that to happen. I mean, you don't need to run the code at all, if you change any ChildSymbol's record field it is also changed in other ParentSymbol's as well. It doesn't act unique to its' ParentSymbol. Which is again, expected. Anyhow, at least we have this script at our hands for future use, I'm calling it a HURRAH! for us (mostly you PAT) and going back to manual labor.

  2. Nice and true saying

    by definition it is harder to debug a program than to write it.

    I would rather demolish a building than doing a retrofit but the world doesn't work like that I guess. Thanks so much again Pat, I don't know how I can express my appreciation but hope you understand. I have stuff to take care of, so it will be a while until I fiddle with this. I'll get back to you.

  3. Ok Pat, I basically turned it into this but the one issue I'm having is the >In< special keyword which I get "reserved for future use" error. I mean, If I can rephrase the part which eliminates objects that do not contain 'MyRecord' then we can get some results. Do you think you can help me with this?

    Also, we assign the H1 handle but never use it, is that for just in case we need it?

    Really appreciate the help, thanks a lot.

    
    {THIS CODE DOES NOT WORK. DO NOT USE IT.} 
    
    Procedure Test;
    
    Var	ParentSymbol:Handle;
    ChildSymbol:Handle;
    SymDefHandle:Handle;
    H1:Handle;
    SymName:String;
    
    Begin
    ParentSymbol:=FSActLayer;
    SymDefHandle:=(GetObject(GetSymName(ParentSymbol)));
    
    ChildSymbol:=FInSymDef(SymDefHandle);
    
    While (GetTypeN(ChildSymbol) <> 15) And (NOT(ChildSymbol In ['MyRecord'])) Do {eliminates objects which are not symbols and do not have 'MyRecord' attached}	 
    	Begin
    		ChildSymbol := NextObj(ChildSymbol);
    	End;
    
    SetRField(ChildSymbol, 'MyRecord', 'MyName', GetRField(ParentSymbol, 'MyRecord', 'MyName'));
    SetRField(ChildSymbol, 'MyRecord', 'MyNumber', GetRField(ParentSymbol, 'MyRecord', 'MyNumber'));
    
    Message(Date(2,2),'  ', GetTypeN(ChildSymbol), '  ', GetSymName(ChildSymbol));
    End;
    
    Run(Test);
    

  4. I am interested of course but the issue which I came to realization is (a bit late I must admit) the fact that I can't set 2 same ParentSymbols different Record fields and expect them to show up inside the ChildSymbol... But nevertheless it would be a useful script in future, so I'm in. The other issue we have is, I do have other symbols in the ParentSymbol but they don't have the record in debate attached to it.

    But you are saying something along the lines of...

    PROCEDURE Impose_Record_Field;	
    VAR; 
           ChildSymbol: HANDLE;
    ParentSymbol: HANDLE;
    ParentSymbolName: STRING;
    MyRField: STRING;
    BEGIN;
           SelectObj((INSYMBOL & INVIEWPORT & (L='DesignLayer') & (R IN ['WINDOW INFORMATION'])));
           ParentSymbol:=FSActLayer;
           ChildSymbol:=IF 
    FInSymbol((ActSymbolDef(GetSDName(ParentSymbol))):
    R IN ['WINDOW INFORMATION']
    ELSE: 
    END;
           MyRField:=GetRField(ParentSymbol,'WINDOW INFORMATION','WINDOW TYPE');
           SetRField(ChildSymbol,'WINDOW INFORMATION','WINDOW TYPE',MyRField);	 
    END;
    RUN(Impose_Record_Field);
    

    I'm guessing. Although that was far as I could get which I'm sure there is something wrong again, didn't give it a go yet.

    I just realized you guys had this developer.vectorworks site you guys had where I was just wasting time in vectorlabs, the former seems way more helpful for scripting.

    Anyhow Pat, let me know what you think about 2 ParentSymbols having different Record values and trying to reflect these into the same ChildSymbols. It's a tricky thing, but I would like to accomplish this even if we apply it as the same Record Field value to all the ParentSymbols.

  5. Ok, I just realized this is a bit of a lost cause, better to turn the ChildSymbol into group. I realize that two parentsymbols with 2 different record fields can't have a childsymbol which can accommodate those 2 different record values, because the parentsymbol needs to be the same throughout. Sorry for the confusion and stealing time.

  6. I hear you all. Thanks for all the responses first of all.

    -Pat, I'll give it a try with that addition and let you know how it goes. Although, I guess that

    some other method
    should be when I select the ParentSymbol.

    I mean in order to get a handle on the ChildSymbol do we need to go into every ParentSymbol (meaning; go into symbol edit mode for ParentSymbol and change the record field for the ChildSymbol and get out and do the next one) ? Is this the way to go about OR I'm fine by selecting one ParentSymbol and running the script...

    So maybe this will work... which gets a handle on the child symbol by sharing the same record with the parent... or tries to...

    PROCEDURE Impose_Record_Field;	
    VAR; 
           ChildSymbol: HANDLE;
    ParentSymbol: HANDLE;
    ParentSymbolName: STRING;
    MyRField: STRING;
    BEGIN;
           SelectObj((INSYMBOL & INVIEWPORT & (L='DesignLayer') & (R IN ['WINDOW INFORMATION'])));
           ParentSymbol:=FSActLayer;
           ChildSymbol:=GetObject(IF(S IN [ParentSymbol] (R IN ['WINDOW INFORMATION']);
           MyRField:=GetRField(ParentSymbol,'WINDOW INFORMATION','WINDOW TYPE');
           SetRField(ChildSymbol,'WINDOW INFORMATION','WINDOW TYPE',MyRField);	 
    END;
    RUN(Impose_Record_Field);
    

    Don't think this will work but, I guess you guys got the idea what I'm trying to do, also I'm starting understand it is much more of a needy process than I thought it would be so I think splitting the 2 symbols and grouping them seems to be the option for me to follow.

    -Hippo

    I left a response over at the post thread

    Thanks a lot for the help though.

  7. You can write a script that copies your values into the same record of an other symbol.

    I think this is exactly what I need. I need a script to impose the "parentsymbol"s fields down to the "childsymbol" basically. Just need it to do it on its' own, with a looping script per say.

    Now, I read your solutions as well, and yes I would do option 1 as well if I knew how :) and was able to understand it.

    You can create 2 controlpoints to position them or you can create a special tag in symbol C to set the position for symbol B.

    So you are saying there is an object (maybe you mean a group?) which has control points that dictate the place to insert a symbol? If so, I would love to learn how to do this object...

    Thanks for the input though.

  8. I came up with this script which compiles fine but doesn't do what I want it to do... which is changing the record field string of the "ChildSymbol" to the "ParentSymbol". I know I'm doing something wrong...

    PROCEDURE Impose_Record_Field;	
    VAR ChildSymbol: HANDLE;
    ParentSymbol: HANDLE;
    ParentSymbolName: STRING;
    MyRField: STRING;
    BEGIN	MyRField:=GetRField(ParentSymbol,'WINDOW INFORMATION','WINDOW TYPE');
    	SetRField(ChildSymbol,'WINDOW INFORMATION','WINDOW TYPE',MyRField); 
    END;
    RUN(Impose_Record_Field);
    

  9. Thanks for the quick response,

    I think it would be a useful script to have at the least. If we can get it to loop at certain trigger points I think we can have almost like a parametric object which are controlled by sub-symbols. I know you are going to say why I don't use a PIO, because our office doesn't like them :crazy: so we are still CADing basically but I want my drawings to carry some information and be open to change.

    But when you say I should consider making an object, you mean turning the window tag symbol into a object right?

  10. Hello All,

    I'm trying to do something simple in my point of view but my inability to code gets in the way and I couldn't find anything out there that was similar to this (after a 5-10 min search smirk ). What I'm trying to do is, use embedded symbols and link one's record field to the other and get it to show that value.

    More simply...

    I have a window symbol.

    I also have a window number tag symbol.

    I have a window information record as well, which has the window type field.

    The window information record is attached to the window symbol and the window number tag symbol.

    The number tag symbol is inside the window symbol.

    I would like the window number tag symbol to show the window type field of the window information tag which is attached to the window symbol.

    Is there a script out there to do this? Or another way you think that can accomplish the same thing?

    I'm thinking somewhere between the lines of:

    
    PROCEDURE Record Field 2 Record Field;
    
    VAR mothersymbol: string
    CONST MyRec="window information"
    My Field="window type"
    
    BEGIN 
    SET (R.windownumbertag.windowtype IN S.window number tag) TO (R.windownumbertag.windowtype IN S.window symbol)
    END
    RUN Record Field 2 Record Field
    
    

    Something like that... :crazy:

    Thank you very much for your help and time.

  11. Hello All,

    I'm trying to do something simple in my point of view but my inability to code gets in the way and I couldn't find anything out there that was similar to this (after a 5-10 min search :/ ). What I'm trying to do is, use embedded symbols and link one's record field to the other and get it to show that value.

    More simply...

    I have a window symbol.

    I also have a window number tag symbol.

    I have a window information record as well, which has the window type field.

    The window information record is attached to the window symbol and the window number tag symbol.

    The number tag symbol is inside the window symbol.

    I would like the window number tag symbol to show the window type field of the window information tag which is attached to the window symbol.

    Is there a script out there to do this? Or another way you think that can accomplish the same thing?

    I'm thinking somewhere between the lines of:

    PROCEDURE Record Field 2 Record Field;
    BEGIN 
    SET (R.windownumbertag.windowtype IN S.window symbol) TO (R.windownumbertag.windowtype IN S.window number tag)
    END

    Something like that... :)

    Thank you very much for your help and time.

  12. what am I doing wrong here?

    =IF((C='ELEVATION-GLASS-30dB'), '30dB', IF((C='ELEVATION-GLASS-35dB'), '35dB', IF((C='ELEVATION-GLASS-37dB'), '37dB', IF((C='ELEVATION-GLASS-40dB'), '40dB', ''))))

    I'm trying to set the class name as the last string of the whole thing but I keep getting only 40dB and -1 for all the other classes. What to do?

  13. I'm sorry could you explain or share this script that you use for updating VPs?

    I mean correct me if I'm wrong but, what you are saying is, you have a script which updates a certain VP with the similar class visibilities of a saved view once you select it ? That's amazing, I would love something like that. You think you can explain this script?

    Thank you.

  14. I have a question. Is there a line type or tool which draws an infinite line along the design layer? I used to use "xl line" in AutoCad for lining up objects on a line (take it as a guide line) and I have always been curious if VectorWorks had a similar feature. Anybody know what I'm talking about?

  15. I had a nested IF function on one of my database cells. It runs fine but after I got out of the worksheet and tried to edit again all there was displaying was this part;

    =IF(CONCAT, 12, IF(' (', AREA(')'), AREA))

    I had something like this before;

    =IF(('myrecord'.'myfield'='abc'), AREA/2, IF(('myrecord'.'myfield'='xyz'), concat(12,' (', AREA,')'), AREA))

    Also, the database criteria is set to; ((R IN ['myrecord'])) if that helps anything.

    Anybody have an idea why this is happening or is it suppose to happen?

    All help is much appreciated.

  16. Hi Pat,

    You know what I'm trying to do; I'm trying to assign letters to record fields inside a worksheet. So you remember this code right;

    Procedure Number_Objects;
    
    {October 1, 2014}
    {? 2014, Coviana, Inc - Pat Stanford pat@coviana.com}
    {Licensed under the GNU Lesser General Public License}
    
    const	MyRec='Test';
    	MyField='Seq';
    
    Var		NextNum: Integer;
    
    
    Procedure MyProc(H2:Handle);
    Begin
    	SetRField(H2,MyRec,MyField,Num2Str(0,NextNum));
    	NextNum:=NextNum+1;
    End;
    
    Begin
    NextNum:=1;
    ForEachObject(MyProc,((R IN [MyRec])));
    End;
    
    Run(Number_Objects); 

    I'm trying to do the exact same thing but with letters now, if I'm explaining myself clearly.

×
×
  • Create New...