5 Replies Latest reply on Jun 24, 2016 12:56 AM by fuba

    Access RefDes Properties (Text Height, Font Type, ...) in xPCB




      I am looking for a way (via Script / .Net / COM) to get the Properties of the RefDes Text (here in orange) .

      Is there any way to get this info without creating a reference to the Library ? Or will it also be possible by going via the Library ?


      Any help / thoughts apreciated.


      Thanks - fuba


        • 1. Re: Access RefDes Properties (Text Height, Font Type, ...) in xPCB

          That refdes is a new object with VX.  I'm not sure exactly what it is. My guess is either FabricationLayerText or ConductorLayerText.


          In the first case, here's an example of some of the things you might do to interact with it:


                     comps = doc.Components(0)

                   For Each comp In comps


                       'Loop through all the Fab text on the component

                       fabtxt_objs = comp.FabricationLayerTexts

                       fabtxt_obj = Nothing

                       For Each fabtxt_obj In fabtxt_objs

                           If fabtxt_obj.Type = 1 Then 'Select out Assy Text

                               If not fabtxt_obj.TextString = comp.RefDes Then 'stuff other than refdes

                                   fabtxt_obj.Format.Font = assyfont

                                   goto next_fabtxt_obj

                               Else    'refdes


                                   fabtxt_obj.Format.Orientation = 0


                                   fabtxt_obj.Format.HorizontalJust = 0

                                   fabtxt_obj.Format.VerticalJust = 0


                                   if comp.Side = 1 then

                                       fabtxt_obj.Format.Mirrored = false


                                       fabtxt_obj.Format.Mirrored = True

                                   End If


                                   fabtxt_obj.Format.Font = assyfont

                                   fabtxt_obj.Format.Bold = False



                               End If

                           ENd If




          In the case of ConductorLayerText, you would probably treat it similarly, as in

          clayertxts = comp.ConductorLayerTexts

                   For Each clayertxt In clayertxts


                       If clayertxt.TextType = 1 Then        'Type 1 is epcbTextRefDes

                           clayertxt.Format.Height = 50

                           'etc, same as above

                       End If



          Information about the fabrication and conductor layer text objects is in the help.  The .Type and .TextType properties are listed there, with information on what kind of object each type is. 

          1 of 1 people found this helpful
          • 2. Re: Access RefDes Properties (Text Height, Font Type, ...) in xPCB

            I did some testing.  No joy so far.  Doesn't seem to be picked up by either fab or conductor layer text collections.  Will continue investigation and post results.

            • 3. Re: Access RefDes Properties (Text Height, Font Type, ...) in xPCB

              Patrick , -

              thanks for the answer & testing. Thats also my outcome, that this is not accessible.


              The Point why I am looking for this Property is, that the RefDes Text information is always well scaled / sized.


              I did a RefDes Synchronizer for Assembly and Silkscreen Layer,

              similar to here: Assembly and Silkscreen Ref Des rearrange

              but my Problem was that when I modify the Silkscreen or Assembly Layer Text,

              the Extrema, grows and shrinks with the text.


              I also tried other ways (Component Outline / Shape) to scale my RefDes Text,

              but no real success.


              I thought using the RefDes Format especially Position and Text Height,

              of the Part will get best results, but ....


              Hopefully in one of the next releases


              Do you or  someone else know, if Mentor has a kind of wishlist,

              for future releases ?





              • 4. Re: Access RefDes Properties (Text Height, Font Type, ...) in xPCB

                Not sure but I guess what you are searching for is the component fabricationlayertexts -> item.format > hight / font......

                see example in excel vba

                Ist displays the refdes hight,text and format of ONE SELECTED component and changes the refdes hight to 5


                Sub CompsRefdes()

                Set pcbapp = GetObject(, "MGCPCB.ExpeditionPCBApplication")
                Set pcbDoc = pcbapp.ActiveDocument
                retVal = licenseDoc(pcbDoc)
                If (retVal <> 1) Then Set pcbDoc = Nothing
                Set parts = pcbDoc.Components(epcbSelectSelected)
                Set FabLayerText = parts(1).FabricationLayerTexts
                For i = 1 To FabLayerText.Count
                If parts(1).Name = FabLayerText(i).Name Then

                  msgbox FabLayerText(i).Name
                  msgbox FabLayerText(i).Format.Font
                  msgbox FabLayerText(i).Format.Height
                  'change hight value
                  FabLayerText(i).Format.Height = 5
                End If
                Set pcbDoc = Nothing
                Set pcbapp = Nothing
                End Sub

                • 5. Re: Access RefDes Properties (Text Height, Font Type, ...) in xPCB

                  Hell Juergen,


                  thanks for the answer. I already found that one, but this only sets the Font Properties (Type, Height ...) of

                  Silkscreen Fab Layer or the Assembly Fab Layer. I am looking for a way, to get the height of exactely the

                  Part RefDes and assign it to Silkscreen and Assembly Layer.


                  The Big benefit of using that "Part RefDes" is that it is always well scaled and positioned within the component.

                  I have also tried other ways to do a nice scaling of the Silk/Asm Fab Layer Text, but currently withou success.


                  It seems that this is missing in the API like stated by Patrick above.


                  Any other idea how to get that info ?