• This forum is the machine-generated translation of www.cad3d.it/forum1 - the Italian design community. Several terms are not translated correctly.

extract text part from an iproperties

  • Thread starter Thread starter MARCOC
  • Start date Start date

MARCOC

Guest
In a custom iproperties I write a text example 1111_pippo_pluto. ..is an ilogic function or other pwer able to extract from that written only the last 5 letters, more generally, to start from a text, only the some letters?

Thank you very much
 
Last edited by a moderator:
if you look to the left in the ilogic editing window see that there is a browser (fragments/system) and one of the entries is strings. scrolling with the mouse on the various options is highlighted what the command does.
 
Hi.
you can try to create a text parameter in fx and fill it out from ilogic with the iproperties you want
and then you can use the string "split" "strsplit = split" and put between " xx" the text to be cut.
 
Hello Batleo... don't I understand where you have to use the string spit???? in ilogic or fx...riesci to give me an example thank you very much
 
Hi.
here I am because I don't have much time I made you an examplecrea parmatri txt.webpdati iproperties.webpparmatri txt dopo regola.webpname_parameter_of_testo =iproperties.value("project", "description")
strsplit=split(name_parameter_of_text,"pipe")
name_testo_cut= strsplit (0)

the text " txt " is what cuts

Hi.
 
thank you batleo...but the note that from the to esmpio...that I tried and worked...it erases everything that stands after the text that cuts...this is not good in my case...I just have to cut off characters or numbers. . .second problem and that numbers and characters are different for each description. ..the thing that never changes and the position, example ab 34 56 or 12 er fg... what I must cut and always 1 first 2 and the last 2 central digits are always different but always they to keep
 
but did you solve the original problem or do you need other directions? I wasn't more accurate because I thought ilogic's help was clear, but if you still have doubts ask.
 
I have not understood very well what you have to get, but
try to change the variable
name_testo_cut= strsplit (0) --> (1) I do not remember what the difference is but should change qls.

or try to explain better what you want to get, you can think of another way, my was just a proposal
 
changing from 0 to 1 I take everything that is after the cut text.

I must be able to extract a character or number from a text... of which the only thing that is fixed and the position and number of famines. . .

es... abcd_32_ab I have to extract ab finale other sempio 1234_sl_78 I have to extract 78, quandi from a code composed of 4alphanumerici_2alfanumerici_2alfanumerici. .I should always abstract the last 2 characters of the string
 
I place a banal example but really look where I told you that it is written more clearly than I know to explain to you.
Code:
dim code as string

code = "123456789"

messagebox.show("first two characters of 123456789: " & left(code, 2))
messagebox.show("last two characters of 123456789: " & right(code, 2))
messagebox.show("3° and 4th character of 123456789: " & mid(code, 3,2))
 
I imagine that the complete code "abcd_32_ab" is created automatically by other rules or parameters, right?
or insert it by hand?
If it were the case that you auto fill out you can take the source
example
if "abcd_32_ab" is made up of d1+d56+d68 and you only need "d68", you can use that by converting it into text

or how to compile the code?
 
hello catafract to reason excuses...cmq thank you.. I don't understand much about ilogic.. .dexted that you can pull out the part of text you need...it becomes the difficult...I must offer this job from a set...and to fill out a customized prorteties for all parts of the assieme with the last 2 digits of the place an image to understand us better

PROGRESSIVO.webpCan you do that? ? ?
 
if you have found the way to pull out the data you need now you just add the string

iproperties.value("custom", "progressive")= name_parameter_of_text --> the data you need
 
is this compilation only for the parts or even for the assemblies? the part number is unique (I mean, there are no two different files with the same number of parts)?
 
both for parts and assembling... in the same together I can have the final 32 that and a part and the final 32 that and a set
 
Try this on something not vital to you, I think it works but you can never say.
Code:
' aggiorna i numeri progressivi
public sub updateprogressivo()
    dim oapp as application
    set oapp = thisapplication
    
    dim odoc as document
    set odoc = oapp.activeeditdocument
    
    dim spn as string
    spn = readpartnumber(odoc)
    
    dim scode as string
    dim orefdocs as variant
    dim orefdoc as document
    
    call codecreator(odoc)
    
    ' si collega ai documenti usati nell'assieme
    set orefdocs = odoc.allreferenceddocuments

    ' aggiorna tutti i documenti collegati
    if orefdocs.count > 0 then
        for each orefdoc in orefdocs
            call codecreator(orefdoc)
        next
    end if

end sub

private sub codecreator(odoc as document)
    dim spn as string
    spn = readpartnumber(odoc)
    
    dim scode as string
    
    ' se il numero parte è più lungo di due caratteri
    ' prende gli ultimi due caratteri e li copia nella ipropery personalizzata
    if strings.len(spn) > 2 then
        scode = strings.right(spn, 2)
    else
        scode = ""
    end if
    
    call writecustomproperties(odoc, "progressivo", scode)
end sub

private function readpartnumber(odoc as document) as string
    
        
    'definisce vari set di proprietà: ---------------------------------------------------------------------
    dim opropsets as propertysets
    set opropsets = odoc.propertysets
    
    'design tracking proprieties
    dim odesigntrackingproprieties as propertyset
    set odesigntrackingproprieties = opropsets.item("{32853f0f-3444-11d1-9e93-0060b03c1ca6}")
    
    readpartnumber = odesigntrackingproprieties.itembypropid(kpartnumberdesigntrackingproperties).value
    
end function

private sub writecustomproperties(odoc as document, spropid as string, spropvalue as string)
    dim ocustompropset   as propertyset
    set ocustompropset = odoc.propertysets.item("{d5cdd505-2e9c-101b-9397-08002b2cf9ae}")
    
    dim bpropexist as boolean
    bpropexist = false
    
    dim oprop as property
    dim ocustomprop as property
    
    for each oprop in ocustompropset
        if oprop.name = spropid then
            bpropexist = true
            set ocustomprop = oprop
            exit for
        end if
    next
        
    if bpropexist = false then
        call ocustompropset.add(spropvalue, spropid)
    else
        ocustomprop.value = spropvalue
    end if
end sub
it's not ilogic, it's vba: if you're looking in the forum find how and where to copy everything, it's been written a few times now
 
thank you catafract. ..I try to use it then to say...I would like to understand a little more than vba...

Thanks again
 
hello cataphrased
Now I have a question, but I don't know it.
in the axes that I create, the codes are composed of "0000-00 description" or 4 digits - 2 digits and description that takes from the name of the file when saved, I would like to automate the process to turn the num part into "0000/00" (the "/" I need for the management does not accept it in the file name but yes in the part number), take the description and move it in the description item of the iproperties, is feasible?
I have almost found a solution for the parts with ilogics, but in the axioms it does not work because the names always change, can you help me?
 

Forum statistics

Threads
44,997
Messages
339,767
Members
4
Latest member
ibt

Members online

No members online now.
Back
Top