How are you "getting the old block out out the way"? I never figured out how to leave lines in place.
Last time I did something like this,
- %find_system out1 (or the list of what I was adding to)
- get the position of out1 = pos
- get the input port to out1
- get the line handle
- get the source port (out port of in1)
- delete the line
- set_param out1 to position [pos(1)+dx pos(2) pos(3)+dx pos(4)]
- add conv block to 'pos'
- addline in1 to conv
- addline conv to out1
Side note, if the list is really long, name the blocks 'well' and do a loop at the end to add all the lines. My code, with lines added at every step, took 2-3 hours. Doing lines at the end, took 20 mins. [Might only apply to Simulink 6.6.1]
EDIT: Actually, for your specific question, have you tried (no idea if this will work). get_param the port location (x,y location)
or get the port location of the existing block, port location of the new block, and add_line to those
Best Answer