Summary of the invention
In response to the problems existing in the prior art, the purpose of the present invention is to provide a kind of assembly constraints based on SolidWorks
Inheritance method, the present invention is by when rendering model, doing light-weight technologg to the constraint information of model, and will in SolidWorks
The constraint information is stored in sfx lightweight format, when model is imported MakeReal 3D software, by parsing lightweight
Formatted file obtains the constraint information of model, to eliminate the step for redefining model constraint information in MakeReal 3D
Suddenly, labor intensity is significantly reduced, is improved work efficiency.
To achieve the above object, the technical solution adopted by the present invention is that:
A kind of assembly constraint inheritance method based on SolidWorks, comprising the following steps:
S1 creates threedimensional model using SolidWorks software, defines constraint information corresponding with threedimensional model, and to institute
It states threedimensional model and does light-weight technologg;
S2 is connect using the API that the second development interface of SolidWorks software calls directly SolidWorks constraints module
Mouthful;
S3 is obtained the constraint information of the defined good threedimensional model in SolidWorks by the api interface, appointed
The information format for determining sfx format, the threedimensional model and constraint information that will acquire according to parsing and interpretative rule carry out sfx format
Change, the model file of sfx format is saved as after reading by the sfx format of agreement, the model file of the sfx format of preservation retains
The constraint information of threedimensional model;
S4 imports the sfx lightweight formatted file by MakeReal 3D software, by parsing the sfx lightweight
Formatted file obtains the constraint information;
S5 automatically creates constraint corresponding with the threedimensional model according to the constraint information in MakeReal 3D,
Obtain the threedimensional model for having holonomic constriants information.
Specifically, in step S1, to the method for constraint information progress light-weight technologg specifically: in SolidWorks
In software when rendering parameter model, by the model trigonometric ratio of parametrization first under reduction-mode, the three-dimensional that can be rendered is obtained
Model;Then the threedimensional model is parsed into OpenGL or DirectX and is drawn, while inherited parameter characteristic information is simultaneously
Export, finally shows on the screen.
Specifically, in step S3, the defined good constraint information includes the parent object, subobject, constraint class of constraint
The reference position of type and constraint.
Further, it in step S4, after sfx lightweight formatted file is imported MakeReal 3D, needs to pass through
The second development interface of MakeReal 3D is developed, and the data import format of sfx format is increased.
It further,, will also be to sfx format after sfx lightweight formatted file is imported MakeReal 3D in step S4
Structure tree of the model file based on parametrization, point, line, surface, assembly relation, seat, measurement, state parsed, inherited
The threedimensional model of model constraint information.
Further, after parsing obtains the constraint information, by the feature of parametrization described in deep analysis, and to described
Multiple association identification features of parametrization carry out compound parsing, are complete with the constraint information ensured.
Compared with prior art, the beneficial effects of the present invention are: the present invention is by drawing in SolidWorks software
The constraint information of model carries out light-weight technologg, and is called directly using the second development interface of SolidWorks software
The API of Solidworks constraints module gets defined good constraint information, and is saved in sfx lightweight format, is inciting somebody to action
When model imports MakeReal 3D software, by parsing sfx lightweight formatted file, the constraint information of model can be obtained, from
And the step of model constraint information is redefined in MakeReal 3D is eliminated, labor intensity is significantly reduced, is improved
Working efficiency.
Specific embodiment
Below in conjunction with the attached drawing in the present invention, technical solution of the present invention is clearly and completely described, it is clear that
Described embodiments are only a part of the embodiments of the present invention, instead of all the embodiments.Based on the implementation in the present invention
Example, those of ordinary skill in the art's all other embodiment obtained under the conditions of not making creative work belong to
The scope of protection of the invention.
Since the CAD digital prototype model of power plant is using Solidworks software modeling, and model is more detailed, number
It is very big according to measuring, it is all usually the model file of several G, gore the piece number is up to five, 60,000,000, this gives
The virtual reality emulation software of MakeReal3D etc brings certain challenge.Model imports or load is virtual reality emulation
The first step will be brought greatly to subsequent programming development if this step does not solve the problems, such as data lightweight and imports
Workload, and influence whether rendering efficiency, reduce customer experience.So the Lightweight Technology of CAD model is in this project
It is particularly important, while being also a difficult point.
As shown in Figure 1, a kind of assembly constraint inheritance method based on SolidWorks is present embodiments provided, this method tool
Body the following steps are included:
S1 creates threedimensional model using SolidWorks software, defines constraint information corresponding with threedimensional model, and to institute
It states threedimensional model and does light-weight technologg;
S2 is connect using the API that the second development interface of SolidWorks software calls directly SolidWorks constraints module
Mouthful;
S3 is obtained the constraint information of the defined good threedimensional model in SolidWorks by the api interface, appointed
The information format for determining sfx format, the threedimensional model and constraint information that will acquire according to parsing and interpretative rule carry out sfx format
Change, the model file of sfx format is saved as after reading by the sfx format of agreement, the model file of the sfx format of preservation retains
The constraint information of threedimensional model;
S4 imports the sfx lightweight formatted file by MakeReal 3D software, by parsing the sfx lightweight
Formatted file obtains the constraint information;
S5 automatically creates constraint corresponding with the threedimensional model according to the constraint information in MakeReal 3D,
Obtain the threedimensional model for having holonomic constriants information.
Specifically, in step S1, to the method for constraint information progress light-weight technologg specifically: in SolidWorks
In software when rendering parameter model, by the model trigonometric ratio of parametrization first under reduction-mode, the three-dimensional that can be rendered is obtained
Model;Then the threedimensional model is parsed into OpenGL or DirectX and is drawn, while inherited parameter characteristic information is simultaneously
Export, finally shows on the screen.
It further, is specifically that parameterized model is converted into triangle surface by the model trigonometric ratio of parametrization, in order to
Ensure the accuracy parsed to parameterized model, parametric modeling is accurately transformed into triangle surface, needs by three-dimensional
The rendering function of CAD software itself come guarantee parametrization data do not lose;The advantages of SolidWorks reduction-mode is to open
The attribute information and characteristic information of all models are contained when model, but therefore opening speed is very slow, take around 50 minutes left sides
It is right;After opening, model format conversion is carried out with sfx converter, final mask file format is platform proprietary format .sfx
File.
Further, the triangle surface of the model, which simplifies algorithm, can be used following algorithm:
A certain number of points are first distributed on original grid by the first algorithm, then raw using new summit and old vertex
At an intermediate mesh, the old vertex in intermediate mesh is finally deleted, and local triangle is carried out to the polygonal region of generation,
It is formed newly to put the triangular mesh for vertex.Wherein divide and sets up the new one using repulsive force algorithm, the i.e. new point of first random distribution, then
Calculate the repulsive force between new point, according to repulsive force on grid these mobile new points, redistribute them.Repulsive force it is big
The curvature and area of small triangle the distance between with new point, where new point are related.
Second algorithm, searched on initial mesh coplanar or approximate coplanar dough sheet be merged into it is one bigger more
Side shape, then trigonometric ratio obtains less dough sheet again.A seed triangular facet is selected, according to certain criterion by the three of surrounding
It is angular to merge into a bigger face, then boundary is straightened, then trigonometric ratio is carried out to it.Algorithm passes through wired error and more smart
True local triangle extends hither plane and merges algorithm, and is able to carry out automatically when encountering the polygon in similar hole, island
Region segmentation, with generate without hole, island trigonometric ratio threedimensional model.
Further, the threedimensional model obtained for above-mentioned algorithm, will be to its number of vertex before further operation
Mesh is compressed, i.e. triangle strip;In the threedimensional model that above-mentioned algorithm obtains, triangle surface is each separated mostly
, i.e. three vertex indicate a triangle;However wherein many triangles all have public side, are thus triangle
Striping provide the foundation, indicate N number of triangle, need to save 3N using the representation method on each Atria vertex
Vertex, and saved using the triangle of striping and only need N+2 vertex that can indicate, greatly simplify the three of model
Angular dough sheet.
Specifically, in step S3, the defined good constraint information includes the parent object, subobject, constraint class of constraint
The reference position of type and constraint.
Further, it in step S4, after sfx lightweight formatted file is imported MakeReal 3D, needs to pass through
The second development interface of MakeReal 3D is developed, and the data import format of sfx format is increased.
It further,, will also be to sfx format after sfx lightweight formatted file is imported MakeReal 3D in step S4
Structure tree of the model file based on parametrization, point, line, surface, assembly relation, seat, measurement, state parsed, inherited
The threedimensional model of model constraint information.
Further, after parsing obtains the constraint information, by the feature of parametrization described in deep analysis, and to described
Multiple association identification features of parametrization carry out compound parsing, are complete with the constraint information ensured.
The importing of MakeReal3D threedimensional model local importing support mainstream CAD parameterized simulation model (including CATIA V5
Equal softwares output format).Model can ensure completeness and efficiency of the data in conversion process after importing;Knot in digital-to-analogue
Paper mulberry, geological information, material information, assembly relation, the information such as rigging position completely retain in data importing process.
MakeReal3D platform can be very good compatible Solidworks model data, will by way of locally importing
Solidworks model file generates model sfx file format, then is directed into platform scene, can reserving model feature, belong to
Property information, convenient for roaming browsing when carry out device model cognition.
It although an embodiment of the present invention has been shown and described, for the ordinary skill in the art, can be with
A variety of variations, modification, replacement can be carried out to these embodiments without departing from the principles and spirit of the present invention by understanding
And modification, the scope of the present invention is defined by the appended.