• 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
if you explain the problem more clearly and describe the solution adopted for the parties.
 
ok I try with examples
create *.ipt files and save them by e.g. 4676-03 foundl (code + description) and to make coding use of this rule:

{copy part numberiproperties.value ("custom," "num parte intero") = iproperties.value ("project," "part number")
' trasforma part number in testoiproperties.value ("custom," "num in txt") = cstr (iproperties.value ("custom," "num parte intero")
' le 4 cifre de part numberiproperties.value ("custom," "num padre") = left (iproperties.value ("custom," "num in txt"), 4)
' transforms the 4 digits copied into textiproperties.value ("custom," "num padre txt") = cstr (iproperties.value ("custom," "num padre")
' cut the part number where there is - to dxstrsplit = split (iproperties.value ("custom," "num in txt"), "-")
iproperties.value ("custom," "num parte + descr") = strsplit (1)
' turns into text the cut to dxiproperties.value ("custom," "num parte + descr txt") = cstr (iproperties.value ("custom," "num parte + descr")
' cut the part number where there is space to dxstrsplit=split (iproperties.value("custom", "num parte+descr txt"),"
iproperties.value("custom", "descrtxt")= strsplit (1)
' cut the part number where there is spacestrsplit = split (iproperties.value ("custom," "num parte + descr txt"), "")
iproperties.value ("custom," "num parte txt") = strsplit (0)
' compilation iproperties.value("project", "description")=iproperties.value("custom", "descrtxt")
' element separatoreiproperties.value("custom", "separatore")= "/"
' compilationiproperties.value("project", "part number")= iproperties.value("custom", "number father txt")+iproperties.value("custom", "separator")+iproperties.value("custom", "number part txt") }

I tried to describe step by step what he does.

But in the assemblies it doesn't work you know there's a way to make it to all parts of a set?
allego examplesDISTINTA STRUTTURATA.webpNOMI FILE.webp
 
"but in the assemblies it doesn't work" means that it doesn't generate the desired code for the axieme or that you want to pass all the elements of the axieme by doing what it has to do? Like the code I proposed two or three posts does in this discussion?

In the second case I do not know, ilogic I do not know it well, I think it is possible because if you can do it in vba from what I know you can do also in ilogic but they need some conversions that are not clear to me and I do not have time for experiments, sorry.. .
 
Hi.
I apologize for the delay in replying, but it was a very busy week, what I would like to do back to the request "in the assemblies does not do" , my colleagues are a little allergic to ilogic and therefore when I find myself where to handle parts or assemblies created by others, I must rename and or move the description by hand, or when it is okay to open the individual parts and execute the rule of the #22
 
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
Hello, catafract,
beautiful subs, copied and used.
Thank you.
 
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
Hello, catafract,

Can you tell me how to extract the "number revision" from iproperties?
I can extract the code and other fields, but not that.

Besides, would you tell me how you found the ethem of the various properties?

Thank you.
 
thanks catafract,
found, the card is as follows:

- name: "Inventor Summary"
- item: {f29f85e0-4ff9-1068-ab91-08002b27b3d9}
- field: "revision number"

ps: I must know you personally in person!
 

Forum statistics

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

Members online

No members online now.
Back
Top