vba - Change cut view text in CATIA -


i'm working catia v5, , want use macros (vba), have problems!

my question is: how change text of cut view? (see picture)

enter image description here

i tried use : myview.texts.item(1) access "text" i think catia dont consider text...

i want change text without intervention of user ( without selections), can that?

ime, vba scripting in drafting workbench quite tricky @ first..."mytexts" collection of drawingtext objects.

mydrawingtext.text = "mynewtextvalue" 

the main trouble have getting handle on specific text object want modify. found best way around either scan entire drawingtexts collection in drawingview, , apply unique name, drawingtext.name="uniqueobjectname", or create drawing text script , can more handle on drawingtext object put whatever value want in there. creating unique names makes drawing more robust future scripting

myview.texts.count useful item number if last created drawingtext object(s).

i'm happy further explain if need. luck!

update/edit: mentioned above, scripting drafting workbench not straight forward. turns out callout texts not live in drawingtexts collection of drawingview, do live somewhere inside drawing view...in case, you're trying edit "id" of section view..that property isn't exposed through vba either.

there hack/work-around search parent view drawing texts , and logic, you'll need come with, scan selection texts want change. should rename while you're @ it, way it's easier come , find them again.

here's example starting object resolution of front view (the parent view of section view)

sub changecallout()  '---- begin resolution script object : front view  dim drawingdocument1 drawingdocument set drawingdocument1 = catia.activedocument  dim drawingsheets1 drawingsheets set drawingsheets1 = drawingdocument1.sheets  dim drawingsheet1 drawingsheet set drawingsheet1 = drawingsheets1.item("sheet.1")  dim drawingviews1 drawingviews set drawingviews1 = drawingsheet1.views  dim drawingview1 drawingview set drawingview1 = drawingviews1.item("front view") 'this parent view of section view  '---- end resolution script  dim sel selection set sel = drawingdocument1.selection dim callouttext drawingtext  sel.clear 'clear selection / practice sel.add drawingview1 'add parent view selection sel.search "drafting.text,sel" 'this search current selection drawing texts , add them selection  dim thing variant dim integer = 1 sel.count     set thing = sel.item2(i)     set callouttext = thing.value     'do things/logic here determine if callout ifs or case statements     'callouttext.name = "useful unique name"     'callouttext.text = "new callout label" 'whatever want rename next  end sub 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -