Creating frames in python

Forum Forums Visual Components 4.0 Python Programming in VC Creating frames in python

Be sure to read the Forum Rules and Guidelines before start using the Forum.

This topic contains 11 replies, has 4 voices, and was last updated by eme eme 3 months ago.

Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #6721
    CalvinCarson
    CalvinCarson
    Participant

    I am trying to create a frame in python. However although it appears in the graphics window, I cant interact with it in anyway. It also doesnt appear in list of items under the root of the component. This code is directly copied from the help.

    #6723
    CalvinCarson
    CalvinCarson
    Participant

    Ok I figured this out.
    You need to create a series of frames as features and type VC_FRAME under the root node and not a new geometry set of type VC_FRAMESET

    #6724
    CalvinCarson
    CalvinCarson
    Participant

    although oddly it doesnt put the frame in the correct position until you turn the visibility on and off. I have tried turning it on and off in the code but it only does it when you manually click it on/off. Somehow the graphics screen does not update correctly.

    #6745

    JobW
    Participant

    Hi,

    The method .rebuild() does the same thing.

     

    regards

    #6749
    zesty
    zesty
    Moderator

    In op, you are working at geometry set level not feature level. Frame feature is not the same thing as a Frame set.

    Here is a video that explains the difference (link expires in 180 days)

    https://visualcomponents.sharefile.com/d-s8e4d66ce5ac4461b

     

    #6755
    CalvinCarson
    CalvinCarson
    Participant

    Thanks for that great explanation.
    Basically I am exporting frames from solid works to csv format.
    Then importing them to visual components.
    I have for the code working except it doesnt display the frames I have created until I do something else like run and reset the simulation or turn visibility on/off.
    Here is my code….any ideas?

    #6765
    zesty
    zesty
    Moderator

    Try a rebuild of the component, vcComponent.rebuild().

    Here is a link (expires in 3 months) to a video where I show you a different approach using a vcLayoutSchemaPropertyList to create frames in the 3D world. In most cases, you only work with the schema object (define and edit it) using API — do not use the GUI.

    https://visualcomponents.sharefile.com/d-sa3b5ccfd1ca4a739

    If you ever use schema be aware of the following issues as of 4.1 release:


    #1
    Frames might be recreated if you attach layout item to different node.

    #2
    PositionMatrix property might not work at all.
    Workaround would be to create schema property that defines offset.

    #3
    Lines connecting frames might be buggy.

    #4
    Issue with script parsing and complier, so consider using def OnFinalize() to safely generate the schema when loading layout.


    So in the attached layout, I modifed the code I showed in the video to use the OnFinalize() event.

    NB!  Not sure if others are using 4.1, but a workaround for having a separate data.csv file would be to pack the file with the layout using the 4.1 pack folder feature, and then unpack it from auto-generated temp folder.

    Terms:

    schema object – a vcLayoutSchemaPropertyList object

    layout item – an object that exists in a layout, such as drawings, annotations, dimensions and bill of materials

    Attachments:
    You must be logged in to view attached files.
    #6770
    CalvinCarson
    CalvinCarson
    Participant

    app.Simulation.update()
    seems to cure the visibility problem.

    #6772
    zesty
    zesty
    Moderator

    Another trick is sometimes to set or clear selection of the application’s selection manager.

    #6777
    CalvinCarson
    CalvinCarson
    Participant

    I have run through you video and its handy to know.
    However, for the purpose for which I was doing this was to have an lifter or conveyor modelled in another cad system parametrically. Then import the geometry to set up a basic component and then be able to update the paths inside with frames generated from Solid works in this case.
    Therefore when the geometry gets translated for a larger or smaller model then it would be simple to update the paths.
    In the schema method it seems that these cant be directly used with a path in a component due to the frames being in the layout rather than the component. well as far as I can tell anyway.

    #6782
    zesty
    zesty
    Moderator

    Understood. Yes, Frame features is the way to go. Schema frames are considered robot positions, so they cannot be referenced in Path behavior.

    #6805
    eme
    eme
    Participant

    You shouldn’t need to use the vcSimulation.update(). That’s an overkill.

    Rebuilding the frames and rendering should be enough. Like in the snippet below:

     

Viewing 12 posts - 1 through 12 (of 12 total)

You must be logged in to reply to this topic.