Create automatically multiple port

Altair Forum User
Altair Forum User
Altair Employee
edited October 2020 in Community Q&A

Hello,

 

I am looking to simulate a long line of antenna and I need approximately to have 100 ports and each port is associated with a source

 

I found a solution to have directly 100 wires, I create the first one and after I use the command to copy and translate.

 

Is it possible to do the same things for the port ? because for the moment the only way I found is very long, I create each port and after I click on the geometry to associate the port and the wire

 

regards

Tagged:

Answers

  • JIF
    JIF
    Altair Employee
    edited January 2018

    Hello nico7,

     

    There is no easy way to do this in the GUI at the moment. However, this is a great example for scripting and should be very easy to do. I would suggest that you have a look at the material in the User manual and the Example guide regarding scripting in CADFEKO. You only need a basic understanding of scripting to do what you want, since you can script record the actions (perform actions in the GUI and the code to perform those actions are recorded) in CADFEKO and then simply modify it to create 100 or more instances.

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    Hi @nico7

     

    Have a look at the post below, where a script macro was shared that will do what you need. 

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    Hello,

    thanks for your answers

     

    good idea for the script, I never used that and after few test is very useful !!

     

    thanks for you example, I will check that now

     

     

    Regards

     

     

     

     

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    I have a new question

     

    I  try to use a script for my entire model now and I have a problem with the definition of the ground plane

     

    I want a Halsfspacesommerfeld

     

    so at the beginning I create a dielectric as follows :

     

    my_diel = my_project.Media:AddDielectric()
    my_diel.Label = 'mer'
    my_diel.DielectricModelling.RelativePermittivity = 81
    my_diel.DielectricModelling.ConductivityType = cf.Enums.MediumDielectricConductivityTypeEnum.Conductivity
    my_diel.DielectricModelling.Conductivity = '5'

     

    and after I try to choose a ground plane definition method as follows

     

    groundPlane=my_project.GroundPlane
    groundPlane.DefinitionMethod = cf.Enums.GroundPlaneDefinitionMethodEnum.HalfspaceSommerfeld

     

    but I have this error message

     

    Error 17901: Homogeneous half space medium has an invalid value.

     

    and if I try to define a ground plane medium before :
     


    groundPlane.Medium:Add(my_diel)

    Unable to use the property as it is disabled

     

     

     

    If you have any idea,

     

    Nicolas

     

  • JIF
    JIF
    Altair Employee
    edited January 2018

    CADFEKO tries to always be in a consistent state and this is achieved through validation. In this case, validation has you stuck in a corner since you can't do either of the actions without the other. The answer is to make the change at the same time. An example is shown below:

     Environment1 = project.GroundPlane properties = Environment1:GetProperties() properties.DefinitionMethod = cf.Enums.GroundPlaneDefinitionMethodEnum.HalfspaceSommerfeld properties.Medium = Dielectric1 Environment1:SetProperties(properties)

    We use the 'GetProperties()' method to get the properties of the ground plane. We then make changes to the table (making these changes won't affect the model. Finally, we apply the settings in the table to the ground plane with the 'SetProperties()' method and this updates the model.

     

    groundPlane.Medium:Add(my_diel)

    As a side note, this does seem to be correct. You need to assign the medium and not add it with a method.  I didn't test this now - no time. ;-)

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    Thanks for your reply,

    it works now, is very great thanks again

     

    Nico

  • Altair Forum User
    Altair Forum User
    Altair Employee
    edited January 2018

    Hello all,

    I have a new problem,

     

    I used a script to copy and translate a wire :

     

    --Create the wire

    startPoint=cf.Point(0,0,0)
    endPoint=cf.Point(0,0,0.1)

    my_line = my_project.Geometry:AddLine(startPoint,endPoint)

    --Create the ellipse
    ellipse = my_project.Geometry:AddEllipse(startPoint,0.1,0.1)
    -- Union the line and ellipse
     my_Union = my_project.Geometry:Union({ellipse,my_line})

    --Copy and translate the union

    gapx = my_project.Variables:Add('gapx', 3, 'space between each dipole')
    translatePoint=cf.Point(0,gapx.Value,0)
    my_Union:CopyAndTranslate(startPoint,translatePoint,3)

     

     

    and after in the interfarce of FEKO, I want to use the parameter sweep script for the variable gapx but when I change the value of gapx nothing appens 

     

    When I did the copy and translate without a script FEKO keep the variable in the transform but when I used a script FEKO replace the variable by the value of the variable

     

    Have you a idea to keep the variable and not the value


    Regards

    Nicolas

     

     

  • JIF
    JIF
    Altair Employee
    edited January 2018

    I have a new problem,

    Please consider logging new problems in new threads. ;-)

     

    Have you a idea to keep the variable and not the value

    The problem is that you are defining a point that only take three coordinate numbers. You can either create a named point and use that named point in the translate (the named point will then use the variable) or you can set the To and From fields directly  (without defining a point). Below is an example that uses the second option.

     my_project = cf.GetApplication():NewProject()    --Create the wire startPoint=cf.Point(0,0,0) endPoint=cf.Point(0,0,0.1)  my_line = my_project.Geometry:AddLine(startPoint,endPoint)  --Create the ellipse ellipse = my_project.Geometry:AddEllipse(startPoint,0.1,0.1) -- Union the line and ellipse  my_Union = my_project.Geometry:Union({ellipse,my_line})  --Copy and translate the union  gapx = my_project.Variables:Add('gapx', 3, 'space between each dipole')  -- Changes  w.r.t. your script here -- START properties = cf.Translate.GetDefaultProperties() inspect(properties) -- just for you to see what the properties look like properties.From.U = 0 -- This can take numbers or strings properties.From.V = '0' properties.From.N = startPoint.Z properties.To.U   = 0 properties.To.V   = 'gapx' properties.To.N   = 0 my_Union:CopyAndTranslate(properties,3)