Eng-Tips is the largest engineering community on the Internet

Intelligent Work Forums for Engineering Professionals

Text box

Status
Not open for further replies.

Alan Lowbands

Aerospace
May 17, 2017
274
0
0
GB
Hi again,

quick question please.

Is it possibe to alter individual lines in a text box without deleting the other lines ?

eg.
if I wanted to add part number to the text box with one macro and tool and assembly with another.

Tool number
Assembly number
Part number

thanks in advance for any help
 
Replies continue below

Recommended for you

Each of these tools have to be smart enough not to rewrite but rather to append text in a textbox.

The problem is that usually you want your tools to work independently, which is not the case here as you need to parse a text altered by another tool thus you have to know it's logic.

With that in mind it seems to be more reasonable to develop a single tool with multiple functions that a set of single-function tools.
 
Thanks Little Cthullu,

Unfortuanetly, in this case I needed them to be seperate.
The macro adding the third line is run by the person detailing and is linked to the part.
The other two lines are completed by the checker who may not have accsess to the models. this one also completes all the other boarder info, checked by etc.
 
so you have a drawingText with several lines of text?--they are separated by LineFeeds
to get the first line:
Code:
Sub CATMain()
Dim Sel, mytext, TextContent
    Set Sel = CATIA.ActiveDocument.Selection
    Set mytext = Sel.item(1).Value
    TextContent = mytext.text
    MsgBox (Split(TextContent, vbLf)(0))
End Sub

regards,
LWolf
 
Thanks LWolf,

Took some messing about and probably looks hideous to you but it works. :)

--------------------------------------------------------------------
Set DrwText = DrwTexts.GetItem("Text.227M") 'DRAWING TITLE
TextContent = Drwtext.text
'DrawTitle1 = Set in Sheet macro
'DrawTitle3 = Set in Sheet macro
DrawTitle3 = oPartDes
Line1 = (Split(TextContent, vbLf)(0))
Line2 = (Split(TextContent, vbLf)(1))
Line3 = (Split(TextContent, vbLf)(2))
DrwText.text = Line1 & vbCrLf & Line2 & vbCrLf & oPartDes
-------------------------------------------------------------------

my appreciated
Lowbands
 
Status
Not open for further replies.
Back
Top