Skip to main content
16-Pearl
December 13, 2013
Solved

pfcDetailNoteInstructions - TextHeight

  • December 13, 2013
  • 1 reply
  • 2749 views

Hi there,

I am trying to modify the text height of a table note.

What works right now is this:

var xyz = table.GetCellNote(cell);

var new_text_format = xyz.GetInstructions(false);

new_text_format.TextAngle = 12;

xyz.Modify(new_text_format);

But I want to modify the text's height not its angle.

Any suggestions?

    Best answer by jnezu

    Hello MATTHIAS

    Did you already solve this problem.

    Textheight of Detail note is a little bit complicated because textheight can be set by both each line and each segment of a line.

    if you wanna set all texts to same height, the code will be like the following

    var drawing = session.CurrentModel;

    var matrix = drawing.GetSheetTransform(drawing.CurrentSheetNumber).Matrix;

    var xyz = table.GetCellNote(cell);
    var new_text_format = xyz.GetInstructions(false);

    var new_text_lines=new_text_format.textLines;

    for(var i=0;i<new_text_lines;i++)

    {

    var new_text_line=new_text_lines.item(i);

    var new_texts=new_text_line.texts;

    for(var j=0;j<new_texts.count;j++)

    {

    var new_text=new_texts.item(j);

    new_text.TextHeight=12/matrix.Item(0, 0);//<-need to transform the coordinates

    }

    }


    xyz.Modify(new_text_format);

    1 reply

    jnezu7-BedrockAnswer
    7-Bedrock
    March 10, 2014

    Hello MATTHIAS

    Did you already solve this problem.

    Textheight of Detail note is a little bit complicated because textheight can be set by both each line and each segment of a line.

    if you wanna set all texts to same height, the code will be like the following

    var drawing = session.CurrentModel;

    var matrix = drawing.GetSheetTransform(drawing.CurrentSheetNumber).Matrix;

    var xyz = table.GetCellNote(cell);
    var new_text_format = xyz.GetInstructions(false);

    var new_text_lines=new_text_format.textLines;

    for(var i=0;i<new_text_lines;i++)

    {

    var new_text_line=new_text_lines.item(i);

    var new_texts=new_text_line.texts;

    for(var j=0;j<new_texts.count;j++)

    {

    var new_text=new_texts.item(j);

    new_text.TextHeight=12/matrix.Item(0, 0);//<-need to transform the coordinates

    }

    }


    xyz.Modify(new_text_format);

    Mat16-PearlAuthor
    16-Pearl
    March 11, 2014

    Hi Jun,

    thanks for answering. I almost gave up hope solving this problem.

    I will give it a try as soon as I have some spare time to work on it. Maybe by the end of this week.

    Thanks a lot again.

    Mat16-PearlAuthor
    16-Pearl
    March 11, 2014

    OK, I was too curious, if this really would work.

    And it does!!

    After some tweaks:

    var drawing = oSession.CurrentModel;

    var matrix = drawing.GetSheetTransform(drawing.CurrentSheetNumber).Matrix;

    var tables = drawing.ListTables();

    var table = tables.Item(0); // just uses first table

    var cell = pfcCreate("pfcTableCell").Create(2, 1); // this depends on the cell you like to modify

    var xyz = table.GetCellNote(cell);

    var new_text_format = xyz.GetInstructions(false);

    var new_text_lines=new_text_format.TextLines;

    for(var i=0;i<new_text_lines.Count;i++)

    {

    var new_text_line=new_text_lines.Item(i);

    var new_texts=new_text_line.Texts;

    for(var j=0;j<new_texts.Count;j++)

    {

    var new_text=new_texts.Item(j);

    new_text.TextHeight=12/(matrix.Item(0, 0));//<-need to transform the coordinates

    }

    }

    xyz.Modify(new_text_format);

    oSession.CurrentWindow.Repaint();

    drawing.Regenerate();

    But, could You explain this transformation (matrix.Item(0,0))?