CN113609667A - Model layout method, model layout device, computer equipment and storage medium - Google Patents

Model layout method, model layout device, computer equipment and storage medium Download PDF

Info

Publication number
CN113609667A
CN113609667A CN202110870950.XA CN202110870950A CN113609667A CN 113609667 A CN113609667 A CN 113609667A CN 202110870950 A CN202110870950 A CN 202110870950A CN 113609667 A CN113609667 A CN 113609667A
Authority
CN
China
Prior art keywords
model
imported
working space
currently traversed
moving
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN202110870950.XA
Other languages
Chinese (zh)
Other versions
CN113609667B (en
Inventor
敖丹军
黄显彬
曾贵
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shenzhen Chuangxiang 3D Technology Co Ltd
Original Assignee
Shenzhen Chuangxiang 3D Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Shenzhen Chuangxiang 3D Technology Co Ltd filed Critical Shenzhen Chuangxiang 3D Technology Co Ltd
Priority to CN202110870950.XA priority Critical patent/CN113609667B/en
Publication of CN113609667A publication Critical patent/CN113609667A/en
Application granted granted Critical
Publication of CN113609667B publication Critical patent/CN113609667B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F30/00Computer-aided design [CAD]
    • G06F30/20Design optimisation, verification or simulation
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2111/00Details relating to CAD techniques
    • G06F2111/20Configuration CAD, e.g. designing by assembling or positioning modules selected from libraries of predesigned modules
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2113/00Details relating to the application field
    • G06F2113/10Additive manufacturing, e.g. 3D printing

Abstract

The application relates to a model layout method, a device, a computer device and a storage medium, wherein the method comprises the following steps: traversing a model to be imported, placing the currently traversed model to be imported into a first position, close to the edge of a working space, of the working space, and detecting whether the first position is a free space; if yes, gradually moving the currently traversed model to be introduced from the first position along a preset direction according to a first step length until the model to be introduced is collided, returning the currently traversed model to be introduced back to the first step length, and placing the model to be introduced; if not, moving the currently traversed model to be introduced out of the working space, not randomly placing the model to be introduced in the process of sequentially placing the model to be introduced, and not directly placing the model when the first position is the free space, but determining the final placing position according to the moving result, wherein the determined final placing position is more reasonable, namely reasonably arranging the model in the working space, and improving the utilization rate of the working space.

Description

Model layout method, model layout device, computer equipment and storage medium
Technical Field
The present application relates to the field of 3D printing technologies, and in particular, to a model layout method and apparatus, a computer device, and a storage medium.
Background
The field of application of three-dimensional (3D) printing technology is becoming wider and wider under the push of computer digital technology intellectualization, and 3D printing is to manufacture a three-dimensional object by printing a layer by layer of adhesive material. When 3D printing is carried out, when a large number of models are imported by a user, the models need to be firstly laid out in a working space formed by a printing platform in slicing software, then slicing processing is carried out, and a model file is converted into a gcode file for printing. However, when the models are laid out in the workspace, the prior art may place the first model randomly, and then find a suitable position around the placed model to place the remaining models, but since the first model may be a smaller model and the placed position is close to the central position of the workspace, and then the place where the model can be placed may not be found when the larger model is placed, the workspace utilization rate is low.
Disclosure of Invention
In view of the above, it is necessary to provide a model layout method, apparatus, computer device and storage medium for solving the above technical problems.
The embodiment of the application provides a model layout method, which comprises the following steps: traversing a model to be introduced, placing the currently traversed model to be introduced into a first position which is in a working space and is close to the edge of the working space, and detecting whether the first position is a free space, wherein the free space is a space in which the model to be introduced is positioned in the working space and the model to be introduced is not collided when the model to be introduced is placed into the current position; if so, moving the currently traversed model to be imported from a first position, determining a final placement position of the currently traversed model to be imported according to a movement result, placing, and modifying the state of the currently traversed model to be imported into a marked state; if not, moving the currently traversed model to be imported out of the working space, and keeping the state of the currently traversed model to be imported as not-placed.
An embodiment of the present application further provides a model layout apparatus, including: the detection module is used for traversing the model to be imported, placing the currently traversed model to be imported into a first position which is in a working space and is close to the edge of the working space, and detecting whether the first position is an idle space, wherein the idle space is a space in which the model to be imported is positioned in the working space and the model to be imported is not collided when the model to be imported is placed into the current position; if so, moving the currently traversed model to be imported from a first position, determining a final placement position of the currently traversed model to be imported according to a movement result, placing, and modifying the state of the currently traversed model to be imported into a marked state; if not, moving the currently traversed model to be imported out of the working space, and keeping the state of the currently traversed model to be imported as not-placed.
The embodiment of the present application further provides a computer device, which includes a memory and a processor, where the memory stores a computer program, and the processor implements the model layout method when executing the computer program.
An embodiment of the present application further provides a computer-readable storage medium, on which a computer program is stored, and the computer program, when executed by a processor, implements the model layout method described above.
In addition, the moving the currently traversed model to be imported from the current position, determining the final placement position of the currently traversed model to be imported according to the moving result, placing, and modifying the state of the currently traversed model to be imported into a marked state includes: entering a first determination step, the first determination step comprising: moving the currently traversed model to be imported from the current position by a first step length along a first direction, and detecting whether the current position is the free space; if yes, re-entering the first determination step; if not, returning the currently traversed model to be imported from the current position by one first step length along the reverse direction of the first direction, and entering a second determination step, wherein the second determination step comprises: and moving the currently traversed model to be imported from the current position by a first step length along a second direction, detecting whether the current position is the free space, if not, returning the currently traversed model to be imported from the current position by the first step length along the direction opposite to the second direction to serve as a final placement position, placing, modifying the state of the currently traversed model to be imported into a mark state, and if so, re-entering the second determination step. By the method, the placement position of the currently traversed model to be imported is determined from two directions, so that the determined placement position of the currently traversed model to be imported is reasonable.
In addition, after traversing the model to be imported, the method further comprises the following steps: traversing an undisplaced model to be imported, placing the currently traversed undisplaced model to be imported into a second position which is in the working space and is close to the edge of the working space, detecting whether the currently traversed undisplaced model to be imported exceeds the working space at the second position, if so, moving the currently traversed undisplaced model to be imported out of the working space, keeping the state of the currently traversed undisplaced model to be imported as still undisplaced, and if not, entering a third determination step, wherein the third determination step comprises: detecting whether the currently traversed and unset model to be imported collides at the current position, if not, taking the current position as the final placement position of the currently traversed and unset model to be imported, placing and modifying the state of the currently traversed and unset model to be imported into a marked state, if so, moving the currently traversed and unset model to be imported from the current position along a third direction by a second step length, detecting whether the current position of the currently traversed and unset model to be imported exceeds the working space on a horizontal axis where the third direction is located, and if not, re-entering the third determination step. Through twice ergodic, can put into workspace with as much as possible model to the reasonable overall arrangement of model, improve workspace's utilization ratio, and the second time ergodic, all start from the second position at every turn, utilize workspace that like this can be reasonable, thereby when can placing the leading-in model of treating that the not placing of current ergodic was placed, find reasonable place and place.
In addition, after the detecting whether the current position of the currently traversed and unplaced model to be imported exceeds the working space on the horizontal axis in which the third direction is located, the method further includes: if so, moving the currently traversed and unset model to be introduced from the current position to a junction between the horizontal direction of the currently traversed and unset model to be introduced and the vertical direction of the second position, moving the second step length from the current position along the fourth direction, detecting whether the currently traversed and unset model to be introduced exceeds the working space on the horizontal axis of the fourth direction at the current position, if not, re-entering the third determination step, if so, moving the currently traversed and unset model to be introduced out of the working space, and keeping the state of the currently traversed and unset model to be introduced as still unset. By the method, the placing positions of the currently traversed and un-placed models to be imported are determined from two directions, so that the determined placing positions of the currently traversed and un-placed models to be imported are reasonable.
In addition, after the detecting whether the currently traversed and unplaced model to be imported exceeds the working space on the horizontal axis in which the third direction is located, the method further includes: if so, returning the currently traversed and unset model to be introduced by one second step length, moving the model to the fourth direction by one second step length, detecting whether the currently traversed and unset model to be introduced exceeds the working space on a horizontal axis where the fourth direction is located, if not, enabling the third direction to be the direction during returning, and entering the third determination step again, if so, moving the currently traversed and unset model to be introduced out of the working space, and keeping the state of the currently traversed and unset model to be introduced as still unset. By the method, the placing positions of the currently traversed and un-placed models to be imported are determined from two directions, so that the determined placing positions of the currently traversed and un-placed models to be imported are reasonable.
In addition, when the workspace is rectangular, the first direction is a direction pointing from the current position to the inside of the workspace and parallel to one side of the workspace, the second direction is a direction perpendicular to the first direction, the third direction is a direction pointing from the current position to the inside of the workspace and parallel to one side of the workspace, and the fourth direction is a direction perpendicular to the third direction. If the working space is rectangular, the first direction, the second direction, the third direction and the fourth direction are arranged in such a way that the movement of the model is more reasonable, so that the final placement position of the determined model is more reasonable, and the utilization rate of the working space is further improved.
In addition, after traversing the un-placed model to be imported, the method further comprises: traversing the model to be imported which is not placed yet, and entering a fourth determining step, wherein the fourth determining step comprises the following steps: expanding the current working space, placing the currently traversed model to be introduced which is not placed yet into the current working space and is close to a third position of the current working space, and detecting whether the third position is an idle space; if so, taking the third position as the final placement position of the currently traversed model to be imported, which is not yet placed, placing the model and modifying the state of the currently traversed model to be imported, which is not yet placed, into a marked state; if not, moving the model to be imported from the current position along the edge of the current working space, and if not, finding the free space before traversing the edge of the working space, if so, taking the free space as the final placement position of the model to be imported which is traversed currently and not yet, placing the model to be imported which is traversed currently and not yet, modifying the state of the model to be imported which is traversed currently and not yet to be placed into the model to be imported into the model to be marked, and if not, re-entering the fourth step. Through expanding workspace, can put into workspace with the model of treating leading-in that still not place, and make the user can know which models this time outside workspace, this time can't print.
In addition, the expanding the edge of the current workspace includes: and determining an expansion range according to the size of the currently traversed model to be introduced which is not placed yet, and expanding the current working space according to the expansion range. The expansion range determined by the method is reasonable, and the model to be imported which is traversed at present and is not yet placed can be placed and marked quickly.
In addition, before the traversing the model to be imported, the method further comprises: sorting the models to be imported from big to small; the traversing of the model to be imported comprises the following steps: and traversing the model to be imported according to the sequence. When the model is placed in the working space, the possibility that the placeable position cannot be found when the smaller model to be introduced is placed in the working space, and the larger model to be introduced is placed in the working space can be reduced, so that the working space is utilized more reasonably, and the utilization rate of the working space is further improved.
In addition, before traversing the undisplaced model to be imported, the method further includes: moving the placed model to a central location of the workspace. By the method, when the model to be introduced which is not placed does not exist, the placed model is moved to the central position of the working space, so that the position of the placed model on the printing platform when the placed model is printed is more reasonable, and when the model to be introduced which is not placed exists, the placed model is moved to the central position of the working space, so that the placed position of the model to be introduced which is not placed can be found quickly.
Drawings
FIG. 1 is a flow chart of a model placement method according to a first embodiment of the present application;
FIG. 2 is a schematic view of a placed model according to a first embodiment of the present application;
FIG. 3 is a flowchart of a specific implementation manner of step 104 in the first embodiment of the present application;
FIG. 4 is a schematic view of a workspace in a first embodiment of the application;
FIG. 5 is a flow chart of a model placement method according to a second embodiment of the present application;
FIG. 6 is a flowchart of a model placement method according to a third embodiment of the present application;
FIG. 7 is a flowchart of a model placement method according to a fourth embodiment of the present application;
FIG. 8 is a schematic view of a workspace in a fourth embodiment of the application;
FIG. 9 is a flowchart of a model placement method according to a fifth embodiment of the present application;
FIG. 10 is a schematic view of a model layout apparatus according to a sixth embodiment of the present application;
fig. 11 is a schematic structural diagram of a computer device according to a seventh embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
The first embodiment of the present application relates to a model layout method, which is applied to a computer device, such as: computers, cell phones, etc. The flowchart of the model layout method of the present embodiment is shown in fig. 1, and includes:
step 101, traversing a model to be imported.
And 102, placing the currently traversed model to be imported into the first position, close to the edge of the working space, of the working space.
Specifically, the working space is a three-dimensional space formed by a printing platform of the printer selected by the user in slicing software, and comprises an X-axis direction, a Y-axis direction and a Z-axis direction, and the model to be imported is a model which is selected by the user and needs to be printed; wherein, the shape of print platform can be set up according to actual need, for example: the horizontal projection shape of the printing platform can be rectangular, circular and the like, and the horizontal projection shape of the working space can also be rectangular, circular and the like.
When traversing to a model to be imported, placing the currently traversed model to be imported into a first position which is close to the edge of a working space and is a preset position, for example: when the working space is rectangular, the first position can be a certain corner or a certain position close to one edge; when the workspace is circular, the first position may be a position near the circumference.
103, detecting whether the first position is an idle space, wherein the idle space is a space where the model to be introduced is placed in the working space and is not collided; if yes, go to step 104, otherwise, go to step 105.
Specifically, when the model to be introduced is placed at the current position, the model to be introduced is placed in a space where the working space is not collided, namely, the model to be introduced is positioned in the working space, namely the bounding box of the model to be introduced is positioned in the working space, the model to be introduced is not collided by the working space and the model to be introduced is not collided by other models, the current position is a free space, when the working space has no placed model, the model to be imported is not collided by other models necessarily, when the working space has the placed model, the collision detection can be performed based on a polygonal bounding box, or based on an axial bounding box, because the calculated amount is less when the axial bounding box is adopted for collision detection, the detection speed can be improved, and it can be understood that, as shown in fig. 2, which is a schematic diagram of the placed model, model B in the diagram is not collided by model a; when the model to be introduced is placed at the current position, the model to be introduced exceeds the working space but the model to be introduced is not collided by other models, or the model to be introduced is positioned in the working space but the model to be introduced is collided by other models, or the model to be introduced exceeds the working space and the model to be introduced is collided by other models, so that the current position is not an idle space; wherein exceeding the workspace means that the model is located outside the workspace and the model is collided by the workspace.
When the current position is a first position, if the currently traversed model to be introduced is placed in a space where the working space is not collided when the model to be introduced is placed in the first position, the first position is an idle space, and if the currently traversed model to be introduced exceeds the working space but the model to be introduced is not collided by other models when the model to be introduced is placed in the first position, or the model to be introduced is located in the working space but the model to be introduced is collided by other models, or the model to be introduced exceeds the working space and the model to be introduced is collided by other models, the first position is not an idle space.
And 104, gradually moving the currently traversed model to be introduced from the first position along a preset direction according to a first step length until the model to be introduced is collided, and then returning the currently traversed model to be introduced back by the first step length and placing the model.
And 105, moving the currently traversed model to be imported out of the working space.
Specifically, the first step length may be a preset step length, the preset step length is set according to actual needs, and the first step length may also be determined according to the size of the currently traversed model to be imported, so that the determined first step length is more accurate. If the first position is detected to be a free space, the first position is a position where the currently traversed model to be introduced can be placed, but there may be other positions where the currently traversed model to be introduced can be placed, so that the currently traversed model to be introduced is moved step by step from the first position along a preset direction according to a first step length until being collided in the moving process, and the collided model refers to being collided by other models and being collided by a working space, and then the currently traversed model to be introduced is returned by the first step length and placed. If the first position is detected not to be a free space, which indicates that the model to be imported cannot be placed at the first position, the currently traversed model to be imported is directly moved out of the working space, and the model to be imported at the moment is the model to be imported which is not placed. In one example, the placed model and the un-placed model may also be distinguished by using a mark, which may be represented by a preset number or letter, such as: the placed model is labeled 1 and the not placed model is labeled 0.
In one example, the preset directions include a first direction and a second direction, the currently traversed model to be imported is moved step by step from a first position along the preset direction by a first step length until the model to be imported is collided, and then the currently traversed model to be imported is returned by the first step length, and a specific placement flowchart is shown in fig. 3, and includes:
step 1041, moving the currently traversed model to be imported from the current position by a first step length along the first direction.
Step 1042, detecting whether the current position is a free space. If yes, the process re-enters step 1041, otherwise, the process enters step 1043.
And 1043, returning the currently traversed model to be imported from the current position by a first step length along the reverse direction of the first direction.
And step 1044, moving the currently traversed model to be imported from the current position by a first step length along a second direction.
Step 1045, detect whether the current location is free space. If yes, re-enter step 1044, otherwise, enter step 1046.
And 1046, returning the currently traversed model to be imported from the current position along the reverse direction of the second direction by a first step length, and placing.
Specifically, the first direction and the second direction are two different directions, and the first direction and the second direction are preset directions; the first step length can be a preset step length, the preset step length is set according to actual needs, and the first step length can also be determined according to the size of the currently traversed model to be imported, so that the determined first step length is more accurate.
If the currently traversed model to be imported is the model A, the model A is gradually moved from the current position, namely the first position 1, along the first direction by the first step length until the moved current position is not the free space, if the model A is moved to the position 3, the position 3 is not the free space, the model A is gradually moved from the current position, namely the position 3, along the reverse direction of the first direction by the first step length, if the model A is returned by the first step length and reaches the position 2, the moving direction is changed into the second direction, the model A is gradually moved from the current position, namely the position 2, along the second direction by the second step length each time until the moved current position is not the free space, if the model A is moved to the position 5, the model A is returned from the current position, namely the position 5, along the reverse direction of the second direction by the first step length, and if the model A is returned by the first step length, when position 4 is reached and position 4 is the final placement position, model a is placed at position 4. By the method, the placement position of the currently traversed model to be imported is determined from two directions, so that the determined placement position of the currently traversed model to be imported is reasonable.
In one example, the preset direction includes a first direction, the currently traversed model to be imported is moved step by step from a first position along the preset direction by a first step length until being collided, and then the currently traversed model to be imported is returned by the first step length and placed, including: entering a first determining step, wherein the first determining step comprises: moving a currently traversed model to be imported from a current position by a first step length along a first direction, and detecting whether the current position is an idle space; if yes, re-entering the first determination step; if not, backing the currently traversed model to be imported from the current position along the reverse direction of the first direction by a first step length.
In one example, when the workspace is rectangular, the first direction is a direction pointing from the current position to the inside of the workspace and parallel to a side of the workspace, and the second direction is a direction perpendicular to the first direction.
Specifically, as shown in fig. 4, which is a schematic diagram of a working space, the working space is a rectangle abcd, and the first position 1 is taken as a corner a for explanation, the first direction and the second direction may be as follows: first, the first direction is the ad direction, i.e. the left direction, the second direction is the ab direction, i.e. the down direction, and the second direction is the ab direction, i.e. the down direction, the first direction is the ad direction, i.e. the down direction.
In the first case, if the currently traversed model to be imported is model a, model a is moved leftward by a first step length from the current position, i.e., first position 1, to position 2, and it is detected whether position 2 is an empty space, if yes, model a is moved leftward by the first step length from the current position, i.e., position 2, to position 3, and it is detected whether position 3 is an empty space, if no, model a is moved backward by the first step length from position 3 to position 2, model a is moved downward by the first step length from the current position, i.e., position 2, to position 4, and it is detected whether position 4 is an empty space, if yes, model a is moved downward by the first step length from current position, i.e., position 4, to position 5, and it is detected whether position 5 is an empty space, if no, model a is moved upward by the first step length from current position, i.e., position 5, and position 4 is a final placement position when it is reached position 4, the model a is placed at position 4. If the working space is rectangular, the first direction and the second direction are set in such a way that the movement of the currently traversed model to be imported is more reasonable, so that the determined placement position of the currently traversed model to be imported is more reasonable.
In the second case, if the currently traversed model to be imported is model a, model a is moved down by a first step length from the current position, namely first position 1, to position 2, and whether position 2 is a free space is detected, if yes, model a is moved down by the first step length from the current position, namely position 2, to position 3, and whether position 3 is a free space is detected, if no, model a is moved back up by the first step length from position 3 to position 2, model a is moved left by the first step length from the current position, namely position 2, to position 4, and whether position 4 is a free space is detected, if yes, model a is moved left by the first step length from the current position, namely position 4, to position 5, and whether position 5 is a free space is detected, if yes, model a is moved left by the first step length from the current position, namely position 5, and position 4 is moved right by the final placement position if position 4 is reached, the model a is placed at position 4. If the working space is rectangular, the first direction and the second direction are set in such a way that the movement of the currently traversed model to be imported is more reasonable, so that the determined placement position of the currently traversed model to be imported is more reasonable.
And step 106, judging whether the model to be imported is traversed completely. If not, the process proceeds to step 107 and then to step 102, and if so, the process ends.
Step 107, traversing the next model to be imported.
In one example, before traversing the model to be imported, the method further comprises: sequencing the models to be imported from large to small, and traversing the models to be imported, wherein the method comprises the following steps: and traversing the model to be imported according to the sequence. Specifically, if the model to be imported is A, B, C, D, E, F, G, and the result of sorting the models to be imported from large to small is B, D, E, G, F, C, A, the models to be imported are traversed according to the sorting of B, D, E, G, F, C, A. When the model is placed in the working space, the possibility that the placeable position cannot be found when the smaller model to be introduced is placed in the working space, and the larger model to be introduced is placed in the working space can be reduced, so that the working space is utilized more reasonably, and the utilization rate of the working space is further improved.
In the embodiment, traversing a model to be introduced, placing the currently traversed model to be introduced into a first position, close to the edge of a working space, of the working space, and detecting whether the first position is a free space, wherein the free space is a space where the model to be introduced is placed into the working space and is not collided; if yes, gradually moving the currently traversed model to be introduced from the first position along a preset direction according to a first step length until the model to be introduced is collided, returning the currently traversed model to be introduced back to the first step length, and placing the model to be introduced; and if not, moving the currently traversed model to be imported out of the working space. Because in the process of placing the model to be led in, the model is not placed at random, but is placed at the edge close to the working space firstly, and is not directly placed when the first position is the free space, but gradually moves from the first position, and the placing position is determined according to the moving result, so that the determined placing position is more reasonable, the possibility of placing the model again is improved, namely, the model is reasonably distributed in the working space, and the utilization rate of the working space is improved.
The second embodiment of the present application relates to a model layout method, which is applied to a computer device, such as: the second embodiment is substantially the same as the first embodiment, except that after traversing the model to be imported, the second embodiment traverses the model to be imported which is not placed, and determines whether a free space exists for placing the currently traversed model to be imported which is not placed. The flowchart of the model layout method of this embodiment is shown in fig. 5, and includes:
step 201, traversing a model to be imported.
Step 202, placing the currently traversed model to be imported into the working space at a first position close to the edge of the working space.
Step 203, detecting whether the first position is an idle space, wherein the idle space is a space where the model to be introduced is placed in the working space and is not collided; if yes, go to step 204, otherwise, go to step 205.
And 204, gradually moving the currently traversed model to be introduced from the first position along a preset direction according to a first step length until the model to be introduced is collided, and then returning the currently traversed model to be introduced back by the first step length and placing the model.
And step 205, moving the currently traversed model to be imported out of the working space.
And step 206, judging whether the model to be imported is traversed completely. If not, go to step 207, then to step 202, and if so, go to step 208.
Step 207, traverse the next model to be imported.
The steps 201-207 are similar to the steps 101-107 in the first embodiment, and are not described herein again.
Step 208, traverse an un-placed model to be imported.
And step 209, placing the currently traversed and unset model to be imported into the second position, close to the edge of the working space, of the working space.
Specifically, the first position and the second position may be two different positions, or may also be the same two positions, where the currently traversed and unplaced model to be imported is placed in the second position of the workspace and close to the edge of the workspace, and the second position is a preset position, for example: when the working space is rectangular, the second position can be a certain corner or a certain position close to one edge; when the workspace is circular, the second position may be a position near the circumference.
Step 2010, detecting whether the currently traversed and unset model to be imported exceeds the working space at the second position. If yes, go to step 2011, otherwise, go to step 2012.
Step 2011, the currently traversed model to be imported which is not placed is moved out of the workspace.
Step 2012, detecting whether the currently traversed and un-placed model to be imported is collided at the current position. If not, go to step 2013, and if yes, go to step 2014.
And 2013, placing at the current position.
Step 2014, moving the currently traversed model to be imported which is not placed to the third direction by a second step length from the current position.
Specifically, the first step length and the second step length may be the same step length or different step lengths, the second step length may be a preset step length, the preset step length is set according to actual needs, and the second step length may also be determined according to the size of the currently traversed model to be imported, which is not placed, so that the determined second step length is more accurate.
Step 2015, detecting whether the currently traversed and un-placed model to be imported exceeds the working space on the horizontal axis where the current position is located in the third direction. If not, the process proceeds to step 2012, and if yes, the process proceeds to step 2016.
Step 2016, moving the currently traversed and un-placed model to be imported to the boundary of the horizontal direction where the currently traversed and un-placed model to be imported is located and the vertical direction where the second position is located, and moving the second step length from the current position along the fourth direction.
Step 2017, detecting whether the currently traversed and un-placed model to be imported exceeds the working space on the horizontal axis where the current position is located in the fourth direction. If not, go to step 2014 again, if yes, go to step 2018.
And 2018, moving the currently traversed model to be imported which is not placed out of the working space.
In one example, when the workspace is rectangular, the third direction is a direction pointing from the current position to the inside of the workspace and parallel to one side of the workspace, and the fourth direction is a direction perpendicular to the third direction.
Specifically, if the workspace is a rectangle abcd as shown in fig. 4, and the second position 1' is taken as the second corner c for example, the third direction and the fourth direction may be as follows: the first, third and fourth directions are cb, i.e., right, and up, respectively, and the second, third and fourth directions are cb, i.e., right, respectively.
Under the first condition, if the currently traversed and unplaced model to be imported is a model B, the model B is placed in a second position 1 ', whether the model B exceeds the working space at the second position 1 ' is detected, if so, the model B cannot be placed at the moment, the model B is moved out of the working space, the model B is a model which is not yet placed, if not, whether the model B is collided at the second position 1 ' is detected, if not, the second position 1 ' is a placing position, the model B is placed at the position 1 ', if so, the model B is moved to the right from the current position, namely the second position 1 ', to a position 2 ', whether the model B exceeds the working space at the position 2 ' in the cb direction is detected, if not, whether the model B is collided at the position 2 ' is detected, if so, the model B is moved to the right from the current position, namely the second step at the position 2 ', to a position 3 ', detecting whether the model B exceeds the working space in cb direction at the position 3 ', if so, moving the model B from the position 3' to the position 1 'and moving it up by a second step size to the position 4', detecting whether the model B exceeds the working space in cd direction at the position 4 ', if not, moving the model B to the right by the second step size from the current position, i.e. the position 4', to the position 5 ', detecting whether the model B exceeds the working space in cb direction at the position 5', if not, detecting whether the model B is collided at the position 5 ', if so, moving the model B to the right by the second step size from the current position, i.e. the position 5', to the position 6 ', detecting whether the model exceeds the working space in cb direction at the position 6', if so, moving the model B from the position 6 'to the position 4', and moving it up by the second step size to the position 7 ', detecting whether the model B exceeds the working space in cd direction at the position 7', if yes, the model B is moved out of the working space, and the model B is a model which is not placed yet. If the working space is rectangular, the third direction and the fourth direction are set in such a way, so that the movement of the currently traversed and unset model to be imported is more reasonable, and the determined placement position of the currently traversed and unset model to be imported is more reasonable.
Under the second condition, if the currently traversed and unplaced model to be imported is a model B, the model B is placed in a second position 1 ', whether the model B exceeds the working space at the second position 1 ' is detected, if so, the model B cannot be placed at the moment, the model B is moved out of the working space, the model B is a model which is not yet placed, if not, whether the model B is collided at the second position 1 ' is detected, if not, the second position 1 ' is a placing position, the model B is placed at the position 1 ', if so, the model B is moved upwards by a second step length from the current position, namely the second position 1 ', to reach a position 2 ', whether the model B exceeds the working space at the position 2 ' in the cd direction is detected, if not, whether the model B is collided at the position 2 ' is detected, if so, the model B is moved upwards by the second step length from the current position, namely the position 2 ', to reach a position 3 ', detecting whether the model B exceeds the working space in the cb direction at the position 3 ', if so, moving the model B from the position 3' to the position 1 ', and moving the model B by a second step in the cb direction to the position 4', detecting whether the model B exceeds the working space in the cb direction at the position 4 ', if not, moving the model B by the second step in the cb direction from the current position, i.e., the position 4', to the position 5 ', detecting whether the model B exceeds the working space in the cd direction at the position 5', if not, detecting whether the model B is collided at the position 5 ', if so, moving the model B by the second step in the cd direction from the current position, i.e., the position 5', to the position 6 ', detecting whether the model exceeds the working space in the cd direction at the position 6', if so, moving the model B from the position 6 'to the position 4', and moving the second step in the right direction to the position 7 ', detecting whether the model B exceeds the working space in the cd direction at the position 7', if yes, the model B is moved out of the working space, and the model B is a model which is not placed yet. If the working space is rectangular, the third direction and the fourth direction are set in such a way, so that the movement of the currently traversed and unset model to be imported is more reasonable, and the determined placement position of the currently traversed and unset model to be imported is more reasonable.
It is understood that, if the workspace is a rectangle abcd as shown in fig. 4, taking the first position 1 as the first corner a and the second position 1' as the second corner c as an example, the first direction and the second direction may exist, and the third direction and the fourth direction may exist in any combination, i.e., the first direction is the ad direction, i.e., the left direction, the second direction is the ab direction, i.e., the down direction, the third direction is the cb direction, i.e., the right direction, the fourth direction is the cd direction, i.e., the up direction, alternatively, the first direction is an ad direction, i.e., a left direction, the second direction is an ab direction, i.e., a down direction, the third direction is a cd direction, i.e., an up direction, the fourth direction is a cb direction, i.e., a right direction, alternatively, the first direction is an ab direction, i.e., a downward direction, the second direction is an ad direction, i.e., a downward direction, the third direction is a cd direction, i.e., an upward direction, and the fourth direction is a cb direction, i.e., a rightward direction.
And step 2019, judging whether the model to be imported which is not placed is traversed completely. If not, the process proceeds to step 2020, and then to step 209, and if so, the process ends.
Step 2020, traverse the next un-placed model to be imported.
In one example, before traversing the model to be imported, the method further comprises: sequencing the models to be imported from large to small, and traversing the models to be imported, wherein the method comprises the following steps: traversing the model to be imported according to the sequence; traversing the un-placed model to be imported, comprising: and traversing the un-placed models to be imported according to the sequence.
Specifically, if the model to be imported is A, B, C, D, E, F, G, and the result of sorting the models to be imported from large to small is B, D, E, G, F, C, A, the models to be imported are traversed according to the sorting of B, D, E, G, F, C, A when traversing the models to be imported, and after the models to be imported are traversed, the models to be imported E, C, A are placed, the models B, D, G, F are the models to be imported which are not placed, and the models to be imported which are not placed are traversed according to the sorting of B, D, G, F when traversing the models to be imported which are not placed. When the model is placed in the working space, the possibility that the placeable position cannot be found when the smaller model to be introduced is placed in the working space, and the larger model to be introduced is placed in the working space can be reduced, so that the working space is utilized more reasonably, and the utilization rate of the working space is further improved.
In one example, before traversing the un-placed model to be imported, the method further comprises: the placed model is moved to the central position of the workspace. By the method, when the model to be introduced which is not placed does not exist, the placed model is moved to the central position of the working space, so that the position of the placed model on the printing platform when the placed model is printed is more reasonable, and when the model to be introduced which is not placed exists, the placed model is moved to the central position of the working space, so that the placed position of the model to be introduced which is not placed can be found quickly.
In the embodiment, through two times of traversal, as many models as possible can be placed into the working space, so that the models are reasonably arranged, the utilization rate of the working space is improved, and in the second time of traversal, the models are started from the second position every time, so that the working space can be reasonably utilized, and when the currently traversed and unset model to be introduced can be placed, a reasonable placing position is found for placing; and the placement positions of the currently traversed and un-placed models to be imported are determined from two directions, so that the determined placement positions of the currently traversed and un-placed models to be imported are reasonable.
The third embodiment of the present application relates to a model layout method, which is applied to a computer device, for example: the third embodiment is substantially the same as the first embodiment, except that in the third embodiment, after traversing the model to be imported, the model to be imported that is not placed is traversed, and whether a free space exists for placing the currently traversed model to be imported that is not placed is determined. The flowchart of the model layout method of this embodiment is shown in fig. 6, and includes:
step 301, traverse a model to be imported.
Step 302, the currently traversed model to be imported is placed in the first position of the working space, which is close to the edge of the working space.
Step 303, detecting whether the first position is an idle space, wherein the idle space is a space where a model to be introduced is placed in a working space and is not collided; if yes, go to step 304, otherwise, go to step 305.
And 304, gradually moving the currently traversed model to be introduced from the first position along a preset direction according to a first step length until the model to be introduced is collided, and then backing the currently traversed model to be introduced back by the first step length and placing the model.
And 305, moving the currently traversed model to be imported out of the working space.
And step 306, judging whether the model to be imported is traversed completely. If not, go to step 307 and then to step 302, and if yes, go to step 308.
Step 307, traversing the next model to be imported.
Steps 301-307 are similar to step 101-107 in the first embodiment, and are not described herein again.
Step 308, traverse an un-placed model to be imported.
Step 309, placing the currently traversed and un-placed model to be imported into the second position of the workspace, which is close to the edge of the workspace.
Specifically, the first position and the second position may be two different positions, or may also be the same two positions, where the currently traversed and unplaced model to be imported is placed in the second position in the workspace and close to the edge of the workspace, and the second position is a preset position, for example: when the working space is a rectangle, a first position in the working space and close to the edge of the working space can be a certain corner, and can also be a certain position close to a certain edge, and when the working space is a circle, a second position in the working space and close to the edge of the working space can be a certain position close to the circumference.
Step 3010, detect whether the currently traversed un-placed model to be imported exceeds the workspace at the second location. If yes, go to step 3011, otherwise, go to step 3012.
Step 3011, move the currently traversed model to be imported which is not placed out of the workspace.
Step 3012, detect whether the currently traversed un-placed model to be imported collides with the placed model at the current position. If not, go to step 3013, if yes, go to step 3014.
Step 3013, place at the current location.
And step 3014, moving the currently traversed un-placed model to be imported to the current position by a second step size along the third direction.
Specifically, the first step length and the second step length may be the same step length or different step lengths, the second step length may be a preset step length, the preset step length is set according to actual needs, and the second step length may also be determined according to the size of the currently traversed model to be imported, which is not placed, so that the determined second step length is more accurate.
Step 3015, detect whether the currently traversed un-placed model to be imported exceeds the working space on the horizontal axis where the current position is located in the third direction. If not, go to step 3012, if yes, go to step 3016.
And step 3016, returning the currently traversed un-placed model to be imported back by a second step size, and moving the second step size in the fourth direction.
Step 3017, detect whether the currently traversed un-placed model to be imported exceeds the working space on the horizontal axis of the fourth direction. If not, go to step 3019, then go to step 3014, and if yes, go to step 3018.
Step 3018, move the currently traversed model to be imported which is not placed out of the workspace.
Step 3019, let the third direction be the backward direction.
In one example, when the workspace is rectangular, the third direction is a direction pointing from the current position to the inside of the workspace and parallel to one side of the workspace, and the fourth direction is a direction perpendicular to the third direction.
Specifically, if the workspace is a rectangle abcd as shown in fig. 4, and the second position 1' is taken as the second corner c for example, the third direction and the fourth direction may be as follows: the first, third and fourth directions are cb, i.e., right, and up, respectively, and the second, third and fourth directions are cb, i.e., right, respectively.
Under the first condition, if the currently traversed and unplaced model to be imported is a model B, the model B is placed in a second position 1 ', whether the model B exceeds the working space at the second position 1 ' is detected, if so, the model B cannot be placed at the moment, the model B is moved out of the working space, the state of the model B is kept to be not placed yet, if not, whether the model B is collided at the second position 1 ' is detected, if not, the second position 1 ' is a placing position, the model B is placed at the position 1 ', if so, the model B is moved to the right from the current position, namely the second position 1 ', to a position 2 ', whether the model B exceeds the working space at the position 2 ', if not, whether the model B is collided at the position 2 ', if so, the model B is moved to the right from the current position, namely the position 2 ', to a position 3 ', detecting whether the model B exceeds the working space in the cb direction at a position 3 ', if so, moving the model B from the position 3 ' to a position 2 ' and moving the second step upwards to reach the position 4 ', detecting whether the model B exceeds the working space in the cd direction at the position 4 ', if not, moving the model B from the current position 4 ' to the bc direction by the second step to the left to reach the position 5 ', detecting whether the model B exceeds the working space in the cb direction at the position 5 ', if not, detecting whether the model B is collided at the position 5 ', if so, moving the model B from the current position 5 ' to the left by the second step to reach the position 6 ', detecting whether the model exceeds the working space in the cb direction at the position 6 ', if so, moving the model B from the position 6 ' to the position 5 ' and moving the second step upwards to reach the position 7 ', it is detected whether the model B exceeds the working space in the cd direction at the position 7', and if so, the model B is moved out of the working space, the model B being a model that has not yet been placed. If the working space is rectangular, the third direction and the fourth direction are set in such a way, so that the movement of the currently traversed and unset model to be imported is more reasonable, and the determined placement position of the currently traversed and unset model to be imported is more reasonable.
Under the second condition, if the currently traversed and unplaced model to be imported is a model B, the model B is placed in a second position 1 ', whether the model B exceeds the working space at the second position 1 ' is detected, if so, the model B cannot be placed at the moment, the model B is moved out of the working space, the state of the model B is kept to be not placed yet, if not, whether the model B is collided at the second position 1 ' is detected, if not, the second position 1 ' is a placing position, the model B is placed at the position 1 ', if so, the model B is moved upwards by a second step length from the current position, namely the second position 1 ', to reach a position 2 ', whether the model B exceeds the working space at the position 2 ', if not, whether the model B is collided at the position 2 ', if so, the model B is moved upwards by the second step length from the current position, namely the position 2 ', to reach a position 3 ', detecting whether the model B exceeds the working space in the cd direction at the position 3 ', if so, moving the model B from the position 3 ' to the position 2 ', moving the model B to the right by a second step length to reach the position 4 ', detecting whether the model B exceeds the working space in the cb direction at the position 4 ', if not, moving the model B from the current position, namely the position 4 ', to the dc direction, namely, moving the second step length downwards to reach the position 5 ', detecting whether the model B exceeds the working space in the cd direction at the position 5 ', if not, detecting whether the model B is collided at the position 5 ', if so, moving the model B from the current position, namely the position 5 ' to the right by the second step length to reach the position 6 ', detecting whether the model exceeds the working space in the cd direction at the position 6 ', if so, moving the model B from the position 6 ' to the position 5 ', moving the second step length to reach the right, and moving the model B to the position 7 ', and detecting whether the model B exceeds the working space in the cb direction at the position 7', if so, moving the model B out of the working space, and keeping the state of the model B as not-yet-placed. If the working space is rectangular, the third direction and the fourth direction are set in such a way, so that the movement of the currently traversed and unset model to be imported is more reasonable, and the determined placement position of the currently traversed and unset model to be imported is more reasonable.
It is understood that, if the workspace is a rectangle abcd as shown in fig. 4, taking the first position 1 as the first corner a and the second position 1' as the second corner c as an example, the first direction and the second direction may exist, and the third direction and the fourth direction may exist in any combination, i.e., the first direction is the ad direction, i.e., the left direction, the second direction is the ab direction, i.e., the down direction, the third direction is the cb direction, i.e., the right direction, the fourth direction is the cd direction, i.e., the up direction, alternatively, the first direction is an ad direction, i.e., a left direction, the second direction is an ab direction, i.e., a down direction, the third direction is a cd direction, i.e., an up direction, the fourth direction is a cb direction, i.e., a right direction, alternatively, the first direction is an ab direction, i.e., a downward direction, the second direction is an ad direction, i.e., a downward direction, the third direction is a cd direction, i.e., an upward direction, and the fourth direction is a cb direction, i.e., a rightward direction.
And step 3020, whether the model to be imported which is not placed is traversed or not is judged. If not, the process proceeds to step 3021, and then to step 309, otherwise, the process ends.
And step 3021, traversing the next un-placed model to be imported.
In one example, before traversing the model to be imported, the method further comprises: sequencing the models to be imported from large to small, and traversing the models to be imported, wherein the method comprises the following steps: traversing the model to be imported according to the sequence; traversing the un-placed model to be imported, comprising: and traversing the un-placed models to be imported according to the sequence.
Specifically, if the model to be imported is A, B, C, D, E, F, G, and the result of sorting the models to be imported from large to small is B, D, E, G, F, C, A, the models to be imported are traversed according to the sorting of B, D, E, G, F, C, A when traversing the models to be imported, and after the models to be imported are traversed, the models to be imported E, C, A are placed and marked, the models B, D, G, F are the models to be imported which are not placed, and the models to be imported which are not placed are traversed according to the sorting of B, D, G, F when traversing the models to be imported which are not placed. When the model is placed in the working space, the possibility that the placeable position cannot be found when the smaller model to be introduced is placed in the working space, and the larger model to be introduced is placed in the working space can be reduced, so that the working space is utilized more reasonably, and the utilization rate of the working space is further improved.
In one example, before traversing the un-placed model to be imported, the method further comprises: the placed model is moved to the central position of the workspace. By the method, when the model to be introduced which is not placed does not exist, the placed model is moved to the central position of the working space, so that the position of the placed model on the printing platform when the placed model is printed is more reasonable, and when the model to be introduced which is not placed exists, the placed model is moved to the central position of the working space, so that the placed position of the model to be introduced which is not placed can be found quickly.
In the embodiment, through two times of traversal, as many models as possible can be placed into the working space, so that the models are reasonably arranged, the utilization rate of the working space is improved, and in the second traversal, the models are started from the second position every time, so that the working space can be reasonably utilized, and when the currently traversed and unset model to be led in can be placed, a reasonable placing position is found for placing; and the placement positions of the currently traversed and un-placed models to be imported are determined from two directions, so that the determined placement positions of the currently traversed and un-placed models to be imported are more reasonable, and the utilization rate of the working space is further improved.
A fourth embodiment of the present application relates to a model layout method, which is applied to a computer device, for example: the fourth embodiment is substantially the same as the second embodiment, except that in the second embodiment, after traversing the model to be imported which is not yet placed, the model to be imported which is not yet marked is also traversed, and the model to be imported which is not yet marked is placed. Fig. 7 shows a flowchart of the model layout method of this embodiment, which includes:
step 401, traverse a model to be imported.
And 402, placing the currently traversed model to be imported into the working space at a first position close to the edge of the working space.
Step 403, detecting whether the first position is an idle space, wherein the idle space is a space where the model to be introduced is placed in the working space and is not collided; if yes, go to step 404, otherwise, go to step 405.
And step 404, gradually moving the currently traversed model to be introduced from the first position along a preset direction according to a first step length until the model to be introduced is collided, and then returning the currently traversed model to be introduced back by the first step length and placing the model.
And step 405, moving the currently traversed model to be imported out of the working space.
Step 406, whether the model to be imported is traversed. If not, go to step 407, then go to step 402, and if yes, go to step 408.
Step 407, traverse the next model to be imported.
Step 408, traverse an un-placed model to be imported.
And step 409, placing the currently traversed and unset model to be imported into a second position, which is close to the edge of the working space, of the working space.
Step 4010, detecting whether the currently traversed model to be imported, which is not placed, exceeds the working space at the second position. If yes, go to step 4011, otherwise, go to step 4012.
Step 4011, moving the currently traversed model to be imported which is not placed out of the workspace.
Step 4012, detecting whether the currently traversed model to be imported, which is not placed, is collided at the current position. If not, go to step 4013, if yes, go to step 4014.
And step 4013, placing at the current position.
And 4014, moving the currently traversed model to be imported which is not placed from the current position by a second step length along the third direction.
Step 4015, detecting whether the currently traversed and un-placed model to be imported exceeds the working space on the horizontal axis where the current position is located in the third direction. If not, go to step 4012, if yes, go to step 4016.
Step 4016, moving the currently traversed model to be imported, which is not placed, from the current position to a boundary between the horizontal direction where the currently traversed model to be imported, which is not placed, is located and the vertical direction where the second position is located, and moving the model from the current position along the fourth direction by the second step length.
Step 4017, detecting whether the currently traversed and un-placed model to be imported exceeds the working space on the horizontal axis where the current position is located in the fourth direction. If not, go to step 4014, if yes, go to step 4018.
And 4018, moving the currently traversed model to be imported which is not placed out of the workspace.
And step 4019, whether the model to be imported which is not placed is traversed completely. If not, go to step 4020, then to step 409, and if so, go to step 4021.
Step 4020, traverse the next un-placed model to be imported.
Steps 401-.
Step 4021, traverse a model to be imported which is not yet placed.
Step 4022, expanding the current working space, placing the currently traversed model to be imported which is not placed yet into the current working space into a third position which is close to the current working space, detecting whether the third position is an idle space, if so, entering step 4023, and if not, entering step 4024.
In one example, expanding the current workspace comprises: and determining an expansion range according to the size of the traversed model to be introduced which is not placed yet, and expanding the current working space according to the expansion range.
Specifically, according to the horizontal projection of the currently traversed model to be introduced, which is not yet placed, in the working space, it can be known that the maximum distance of the horizontal projection in the horizontal direction is x, the maximum distance in the vertical direction is y, an expansion range is determined according to x and y, and the edge of the current working space is expanded according to the expansion range. If the current working space is rectangular, two sides of the current working space in the horizontal direction can be respectively expanded by x, and two sides of the current working space in the vertical direction can be respectively expanded by y; or the larger value of x and y can be taken, and the periphery of the current working space is respectively expanded by a larger value. If the current working space is circular, the larger value of x and y can be selected, and the periphery of the current working space is expanded by a larger value. The expansion range determined by the method is reasonable, and the model to be imported which is traversed at present and is not yet placed can be placed and marked quickly.
In one example, the current workspace may be expanded according to a preset expansion range.
Step 4023, placing at a third location.
Step 4024, moving the model to be imported step by step from the third position along the edge of the current working space according to the third step length, detecting whether a free space is found before the edge of the working space is traversed, if so, entering step 4025, and if not, entering step 4022 again.
Step 4025, placing in the free space.
Step 4026, whether the model to be imported which is not placed yet is traversed. If yes, the process ends, otherwise, the process proceeds to step 4027, and then to step 4021.
Step 4027, go through the next model to be imported which is not yet placed.
Specifically, the third step length may be a preset step length, the preset step length is set according to actual needs, and the third step length may also be determined according to the size of the currently traversed model to be imported, so that the determined third step length is more accurate; the third position is a preset position, for example: when the working space is rectangular, the first position can be a certain corner or a certain position close to one edge; when the workspace is circular, the first position may be a position near the circumference. If the traversed model to be introduced which is not placed yet is the model C, the model C is placed in the current working space and is close to the third position of the current working space, whether the third position is a free space is detected, if yes, the model C is placed at the third position, if not, the model C is moved step by step along the edge of the current working space according to the third step length, if a position exists in the process of moving along the edge of the current working space and is the free space, the position is the placement position, the model C is placed at the position, if the position does not exist after moving along the edge of the current working space for one circle, the situation that the expansion is insufficient is indicated, the edge of the current working space is expanded continuously, and the steps are executed repeatedly until the position exists.
The following will be specifically described with reference to an example: as shown in fig. 8, which is a schematic diagram of a working space, wherein the current working space is a rectangle a 'B' C'd', the working space before expansion is a rectangle abcd, the model C is first placed in the third position 1 ", whether the position 1" is a free space is detected, if yes, the position 1 "is a placing position, the model B is placed in the position 1", if no, the model C is moved rightward by a third step from the position 1 "to reach the position 2", whether the model C exceeds the current working space at the position 2 "is detected, if no, whether the model C is collided at the position 2" is detected, if yes, the model C is moved rightward by the third step from the position 2 "to reach the position 3", whether the model C exceeds the current working space at the position 3 "is detected, if yes, the model C is moved backward by the third step to reach the position 2", the model C is moved upward by the third step from the position 2 ", reaching position 4 ", detecting whether the model C exceeds the current working space at position 4", if not, detecting whether the model C is collided at position 4 ", if so, moving the model C a third step length upwards from position 4", reaching position 5 ", detecting whether the model C exceeds the current working space at position 5", if so, returning the model C a third step length, reaching position 4 ", moving the model C a third step length leftwards from position 4", reaching position 6 ", detecting whether the model C exceeds the current working space at position 6", if not, detecting whether the model C is collided at position 6 ", if so, moving the model C a third step length leftwards from position 6", reaching position 7 ", detecting whether the model C exceeds the current working space at position 7", if so, returning the model C a third step length, reaching position 6 ", moving the model C a third step length downwards from position 6", and when the model C reaches the position 8 ', detecting whether the model C exceeds the current working space at the position 8 ', if not, detecting whether the model C collides with the placed model at the position 8 ', if so, moving the model C downwards from the position 6 ' by a third step length to reach the position 9 ', detecting whether the model C exceeds the current working space at the position 9 ', if so, continuing expanding the edge of the current working space, determining the placement position according to the method, if not, detecting whether the model C is collided at the position 9 ', and if not, setting the position 9 ' as the placement position, and placing the model C at the position 9 '.
In one example, before traversing the model to be imported, the method further comprises: sequencing the models to be imported from large to small, and traversing the models to be imported, wherein the method comprises the following steps: traversing the model to be imported according to the sequence; traversing the un-placed model to be imported, comprising: traversing the undisplaced model to be imported according to the sequence; traversing the model to be imported which is not yet placed, comprising: and traversing the model to be imported which is not placed yet according to the sequence.
In one example, before traversing the un-placed model to be imported, the method further comprises: the placed model is moved to the central position of the workspace.
In the embodiment, through two times of traversal, as many models as possible can be placed into the working space, so that the models are reasonably arranged, the utilization rate of the working space is improved, and in the second time of traversal, the models are started from the second position every time, so that the working space can be reasonably utilized, and when the currently traversed and unset model to be introduced can be placed, a reasonable placing position is found for placing; and the placement positions of the currently traversed and un-placed models to be imported are determined from two directions, so that the determined placement positions of the currently traversed and un-placed models to be imported are reasonable.
A fifth embodiment of the present application relates to a model layout method, applied to a computer device, such as: the fifth embodiment is substantially the same as the third embodiment, except that in the fifth embodiment, after traversing the model to be imported which is not yet placed, the model to be imported which is not yet marked is also traversed, and the model to be imported which is not yet marked is placed. Fig. 9 shows a flowchart of the model layout method of this embodiment, which includes:
step 501, traversing a model to be imported.
Step 502, placing the currently traversed model to be imported into the working space at a first position close to the edge of the working space.
Step 503, detecting whether the first position is an idle space, wherein the idle space is a space where the model to be introduced is placed in the working space and is not collided; if yes, go to step 504, otherwise, go to step 505.
And step 504, gradually moving the currently traversed model to be introduced from the first position along a preset direction according to a first step length until the model to be introduced is collided, and then returning the currently traversed model to be introduced back by the first step length and placing the model.
And 505, moving the currently traversed model to be imported out of the working space.
Step 506, whether the model to be imported is traversed. If not, go to step 507 and then to step 502, and if yes, go to step 508.
And step 507, traversing the next model to be imported.
Step 508, traverse an un-placed model to be imported.
And 509, placing the currently traversed and unset model to be imported into the second position, close to the edge of the workspace, of the workspace.
In step 5010, it is detected whether the currently traversed and un-placed model to be imported exceeds the workspace at the second position. If yes, go to step 5011, otherwise, go to step 5012.
Step 5011, moving the currently traversed model to be introduced which is not placed out of the workspace.
Step 5012, detecting whether the currently traversed model to be imported which is not placed collides with the placed model at the current position. If not, go to step 5013, if yes, go to step 5014.
At step 5013, place at the current location.
In step 5014, the currently traversed and unset model to be imported is moved by a second step length from the current position along the third direction.
In step 5015, it is detected whether the currently traversed and un-placed model to be imported exceeds the working space on the horizontal axis where the current position is located in the third direction. If not, go to step 5012, if yes, go to step 5016.
Step 5016, moving the currently traversed and unset model to be introduced back by a second step length to the fourth direction by the second step length.
In step 5017, it is detected whether the currently traversed and unset model to be imported exceeds the working space on the horizontal axis of the fourth direction. If not, go to step 5019, then go to step 5014, if yes, go to step 5018.
In step 5018, the currently traversed model to be imported which is not placed is moved out of the workspace.
In step 5019, the third direction is set as the backspacing direction.
Step 5020, whether the model to be imported which is not placed is traversed or not is judged. If not, go to step 5021, then to step 509, and if yes, go to step 5022.
Step 5021, traversing the next un-placed model to be imported.
Step 501-5021 is similar to step 301-3021 in the third embodiment, and will not be described herein again.
Step 5022, traversing a model to be imported which is not placed yet.
Step 5023, expanding the current working space, placing the currently traversed model to be led in which the model is not yet placed into the current working space at a third position close to the current working space, detecting whether the third position is an idle space, if so, entering step 5023, and if so, entering step 5024.
5024, placing at the third position.
Step 5025, the model to be led in is moved step by step from the current position along the edge of the current working space according to the third step length, whether a free space is found before the edge of the working space is traversed is detected, if yes, the step 5025 is carried out, and if not, the step 5022 is carried out again.
Step 5026, placing in the free space.
Step 5027, whether the model to be imported which is not placed yet is traversed or not is judged. If so, the process ends, otherwise, the process goes to step 5028, and then to step 5022.
Step 5028, traversing the next model to be imported which is not placed yet.
Step 5022-5028 is similar to step 4021-4027, and is not described herein again.
In one example, expanding the current workspace comprises: and determining an expansion range according to the size of the traversed model to be introduced which is not placed yet, and expanding the current working space according to the expansion range.
In one example, the current workspace may be expanded according to a preset expansion range.
In one example, before traversing the model to be imported, the method further comprises: sequencing the models to be imported from large to small, and traversing the models to be imported, wherein the method comprises the following steps: traversing the model to be imported according to the sequence; traversing the un-placed model to be imported, comprising: traversing the undisplaced model to be imported according to the sequence; traversing the model to be imported which is not yet placed, comprising: and traversing the model to be imported which is not placed yet according to the sequence.
In one example, before traversing the un-placed model to be imported, the method further comprises: the placed model is moved to the central position of the workspace.
In this embodiment, by expanding the working space, the model to be introduced that has not yet been placed can be placed in the working space, and the user can know which models are outside the working space this time, and this time cannot be printed.
A sixth embodiment of the present application relates to a model layout apparatus, a schematic structural diagram of the model layout apparatus 601 is shown in fig. 10, and the apparatus 601 includes:
a detecting module 6011, configured to traverse a model to be imported, place the currently traversed model to be imported into a first location in a working space and near an edge of the working space, and detect whether the first location is an idle space, where the idle space is a space where the model to be imported is placed in the working space and is not collided; if yes, gradually moving the currently traversed model to be introduced from a first position along a preset direction according to a first step length until the model to be introduced is collided, and then returning the currently traversed model to be introduced back to the first step length and placing the model to be introduced; and if not, moving the currently traversed model to be imported out of the working space.
For the specific limitations of the apparatus, reference may be made to the limitations of the method described above, which are not described in detail herein. The various modules in the above-described apparatus may be implemented in whole or in part by software, hardware, and combinations thereof. The modules can be embedded in a hardware form or independent from a processor in the computer device, and can also be stored in a memory in the computer device in a software form, so that the processor can call and execute operations corresponding to the modules.
A seventh embodiment of the present application provides a computer device, which may be a terminal, such as: the internal structure of a computer, a mobile phone and the like can be shown in fig. 11. The computer device includes a processor, a memory, a communication interface, a display screen, and an input device connected by a system bus. Wherein the processor of the computer device is configured to provide computing and control capabilities. The memory of the computer device comprises a nonvolatile storage medium and an internal memory. The non-volatile storage medium stores an operating system and a computer program. The internal memory provides an environment for the operation of an operating system and computer programs in the non-volatile storage medium. The communication interface of the computer device is used for carrying out wired or wireless communication with an external terminal, and the wireless communication can be realized through WIFI, an operator network, NFC (near field communication) or other technologies. The computer program is executed by a processor to implement a method of generating a print file. The display screen of the computer equipment can be a liquid crystal display screen or an electronic ink display screen, and the input device of the computer equipment can be a touch layer covered on the display screen, a key, a track ball or a touch pad arranged on the shell of the computer equipment, an external keyboard, a touch pad or a mouse and the like.
Those skilled in the art will appreciate that the architecture shown in fig. 11 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one example, there is also provided a computer device comprising a memory and a processor, the memory having stored therein a computer program, the processor implementing the steps in the above-described method embodiments when executing the computer program.
An eighth embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and the computer program realizes the steps in the above-mentioned method embodiments when being executed by a processor.
In one example, a computer program product or computer program is provided that includes computer instructions stored in a computer-readable storage medium. The computer instructions are read by a processor of a computer device from a computer-readable storage medium, and the computer instructions are executed by the processor to cause the computer device to perform the steps in the above-mentioned method embodiments.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above can be implemented by hardware instructions of a computer program, which can be stored in a non-volatile computer-readable storage medium, and when executed, can include the processes of the embodiments of the methods described above. Any reference to memory, storage, database or other medium used in the embodiments provided herein can include at least one of non-volatile and volatile memory. Non-volatile Memory may include Read-Only Memory (ROM), magnetic tape, floppy disk, flash Memory, optical storage, or the like. Volatile Memory can include Random Access Memory (RAM) or external cache Memory. By way of illustration and not limitation, RAM can take many forms, such as Static Random Access Memory (SRAM) or Dynamic Random Access Memory (DRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the invention. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (13)

1. A method of model placement, comprising:
traversing a model to be introduced, placing the currently traversed model to be introduced into a first position which is in a working space and is close to the edge of the working space, and detecting whether the first position is a free space, wherein the free space is a space in which the model to be introduced is placed into the working space and is not collided;
if yes, gradually moving the currently traversed model to be introduced from a first position along a preset direction according to a first step length until the model to be introduced is collided, and then returning the currently traversed model to be introduced back to the first step length and placing the model to be introduced;
and if not, moving the currently traversed model to be imported out of the working space.
2. The model layout method according to claim 1, wherein the preset directions include a first direction and a second direction, the step-by-step moving the currently traversed model to be imported from the first position along the preset direction by a first step length until the model to be imported is collided, and the step-by-step moving the currently traversed model to be imported back by the first step length and placing comprises:
entering a first determination step, the first determination step comprising:
moving the currently traversed model to be imported from the current position by the first step length along a first direction, and detecting whether the current position is the free space;
if yes, re-entering the first determination step;
if not, backing the currently traversed model to be imported from the current position along the reverse direction of the first direction by the first step length, and entering a second determination step, wherein the second determination step comprises: and moving the currently traversed model to be imported from the current position by the first step length along a second direction, detecting whether the current position is the free space, if not, returning the currently traversed model to be imported from the current position by the first step length along the direction opposite to the second direction, placing, and if so, re-entering the second determining step.
3. The model layout method of claim 2, further comprising, after traversing the model to be imported:
traversing an undisplaced model to be imported, placing the currently traversed undisplaced model to be imported into a second position, close to the edge of the working space, detecting whether the currently traversed undisplaced model to be imported exceeds the working space at the second position, if so, moving the currently traversed undisplaced model to be imported out of the working space, and if not, entering a third determination step, wherein the third determination step comprises:
and detecting whether the currently traversed and unset model to be introduced is collided at the current position, if not, the model to be introduced is placed at the current position, if so, moving the currently traversed and unset model to be introduced from the current position by a second step length along a third direction, detecting whether the currently traversed and unset model to be introduced exceeds the working space on a horizontal axis where the current position is located in the third direction, and if not, entering the third determining step again.
4. The model layout method according to claim 3, wherein after the detecting whether the currently traversed to unplaced model to be imported exceeds the working space on the horizontal axis where the current position is located in the third direction, the method further comprises:
if so, moving the currently traversed and unset model to be introduced from the current position to a junction between the horizontal direction of the currently traversed and unset model to be introduced and the vertical direction of the second position, moving the second step length from the current position along the fourth direction, detecting whether the currently traversed and unset model to be introduced exceeds the working space on the horizontal axis of the fourth direction at the current position, if not, re-entering the third determination step, and if so, moving the currently traversed and unset model to be introduced out of the working space.
5. The model layout method according to claim 3, wherein after the detecting whether the currently traversed to unplaced model to be imported exceeds the workspace on the horizontal axis in the third direction, the method further comprises:
if so, backing the currently traversed and unset model to be introduced back to the second step length, moving the second step length to a fourth direction, detecting whether the currently traversed and unset model to be introduced exceeds the working space on a horizontal axis where the fourth direction is located, if not, enabling the third direction to be the direction during backing, and entering the third determining step again, and if so, moving the currently traversed and unset model to be introduced out of the working space.
6. The model layout method according to claim 4 or 5, wherein when the workspace is rectangular, the first direction is a direction pointing from a current position to an inside of the workspace and parallel to a side of the workspace, the second direction is a direction perpendicular to the first direction, the third direction is a direction pointing from a current position to an inside of the workspace and parallel to a side of the workspace, and the fourth direction is a direction perpendicular to the third direction.
7. The model layout method according to claim 4 or 5, further comprising, after traversing the un-placed model to be imported:
traversing the model to be imported which is not placed yet, and entering a fourth determining step, wherein the fourth determining step comprises the following steps:
expanding the current working space, placing the currently traversed model to be introduced which is not placed yet into the current working space and is close to a third position of the current working space, and detecting whether the third position is an idle space;
if yes, placing at the third position;
if not, gradually moving the model to be introduced from the third position along the edge of the current working space according to the third step length, detecting whether the free space is found before the edge of the working space is traversed, if so, placing the model in the free space, and if not, re-entering the fourth step.
8. The model layout method of claim 7 wherein the dilating an edge of the current workspace comprises:
and determining an expansion range according to the size of the currently traversed model to be introduced which is not placed yet, and expanding the current working space according to the expansion range.
9. The model layout method of claim 1, prior to said traversing the model to be imported, further comprising: sorting the models to be imported from big to small;
the traversing of the model to be imported comprises the following steps: and traversing the model to be imported according to the sequence.
10. The model layout method of claim 3, further comprising, prior to said traversing the unplaced model to be imported:
and moving the placed model to the central position of the working space.
11. A model layout apparatus, comprising:
the detection module is used for traversing the model to be imported, placing the currently traversed model to be imported into a first position which is in a working space and is close to the edge of the working space, and detecting whether the first position is an idle space, wherein the idle space is a space which is not collided when the model to be imported is placed into the working space; if yes, gradually moving the currently traversed model to be introduced from a first position along a preset direction according to a first step length until the model to be introduced is collided, and then returning the currently traversed model to be introduced back to the first step length and placing the model to be introduced; and if not, moving the currently traversed model to be imported out of the working space.
12. A computer device comprising a memory and a processor, the memory storing a computer program, wherein the processor, when executing the computer program, implements a model layout method according to any one of claims 1 to 10.
13. A computer-readable storage medium, on which a computer program is stored, which, when being executed by a processor, carries out the model layout method of any one of claims 1 to 10.
CN202110870950.XA 2021-07-30 2021-07-30 Model layout method, apparatus, computer device and storage medium Active CN113609667B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110870950.XA CN113609667B (en) 2021-07-30 2021-07-30 Model layout method, apparatus, computer device and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110870950.XA CN113609667B (en) 2021-07-30 2021-07-30 Model layout method, apparatus, computer device and storage medium

Publications (2)

Publication Number Publication Date
CN113609667A true CN113609667A (en) 2021-11-05
CN113609667B CN113609667B (en) 2024-03-15

Family

ID=78338690

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110870950.XA Active CN113609667B (en) 2021-07-30 2021-07-30 Model layout method, apparatus, computer device and storage medium

Country Status (1)

Country Link
CN (1) CN113609667B (en)

Citations (15)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104890238A (en) * 2015-04-30 2015-09-09 北京敏速自动控制设备有限公司 Three-dimensional printing method and system thereof
CN107984764A (en) * 2017-09-30 2018-05-04 浙江大学 A kind of 3 D-printing method
CN108714303A (en) * 2018-05-16 2018-10-30 深圳市腾讯网络信息技术有限公司 Collision checking method, equipment and computer readable storage medium
CN108763677A (en) * 2018-05-16 2018-11-06 南华大学 A kind of method, system and the server of dispersion fuel neutron transport simulation
CN109408001A (en) * 2018-08-22 2019-03-01 先临三维科技股份有限公司 3D printing method, apparatus, 3D printing equipment and the storage medium of multi-model
CN110489355A (en) * 2019-08-19 2019-11-22 上海安路信息科技有限公司 The mapping method and its system of logic BRAM
CN110993014A (en) * 2019-11-20 2020-04-10 深圳忆联信息系统有限公司 Behavior test method and device of SSD in idle state, computer equipment and storage medium
CN111216125A (en) * 2019-12-04 2020-06-02 山东省科学院自动化研究所 Obstacle avoidance method and system of moving mechanical arm device facing narrow passage
CN111976135A (en) * 2020-07-13 2020-11-24 深圳市创必得科技有限公司 3D model placing method and device, storage medium and 3D printer
CN112150350A (en) * 2020-09-23 2020-12-29 深圳市创想三维科技有限公司 Model plane layout method, system and computer equipment
CN112546630A (en) * 2020-12-25 2021-03-26 珠海西山居移动游戏科技有限公司 Role moving method and device
CN112802203A (en) * 2021-01-18 2021-05-14 华中科技大学鄂州工业技术研究院 Spatial hash continuous collision detection method based on features
CN112848312A (en) * 2021-02-01 2021-05-28 深圳市创想三维科技有限公司 Method and device for detecting three-dimensional model object, computer equipment and storage medium
CN112989616A (en) * 2017-07-06 2021-06-18 卡尔蔡司光学国际有限公司 Method, apparatus and computer-readable storage medium for virtually fitting spectacle frames
CN113021900A (en) * 2021-03-19 2021-06-25 山东白令三维科技有限公司 Part model placing method in 3D printing and related device

Patent Citations (16)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016173065A1 (en) * 2015-04-30 2016-11-03 北京敏速自动控制设备有限公司 Three-dimensional printing method and system
CN104890238A (en) * 2015-04-30 2015-09-09 北京敏速自动控制设备有限公司 Three-dimensional printing method and system thereof
CN112989616A (en) * 2017-07-06 2021-06-18 卡尔蔡司光学国际有限公司 Method, apparatus and computer-readable storage medium for virtually fitting spectacle frames
CN107984764A (en) * 2017-09-30 2018-05-04 浙江大学 A kind of 3 D-printing method
CN108714303A (en) * 2018-05-16 2018-10-30 深圳市腾讯网络信息技术有限公司 Collision checking method, equipment and computer readable storage medium
CN108763677A (en) * 2018-05-16 2018-11-06 南华大学 A kind of method, system and the server of dispersion fuel neutron transport simulation
CN109408001A (en) * 2018-08-22 2019-03-01 先临三维科技股份有限公司 3D printing method, apparatus, 3D printing equipment and the storage medium of multi-model
CN110489355A (en) * 2019-08-19 2019-11-22 上海安路信息科技有限公司 The mapping method and its system of logic BRAM
CN110993014A (en) * 2019-11-20 2020-04-10 深圳忆联信息系统有限公司 Behavior test method and device of SSD in idle state, computer equipment and storage medium
CN111216125A (en) * 2019-12-04 2020-06-02 山东省科学院自动化研究所 Obstacle avoidance method and system of moving mechanical arm device facing narrow passage
CN111976135A (en) * 2020-07-13 2020-11-24 深圳市创必得科技有限公司 3D model placing method and device, storage medium and 3D printer
CN112150350A (en) * 2020-09-23 2020-12-29 深圳市创想三维科技有限公司 Model plane layout method, system and computer equipment
CN112546630A (en) * 2020-12-25 2021-03-26 珠海西山居移动游戏科技有限公司 Role moving method and device
CN112802203A (en) * 2021-01-18 2021-05-14 华中科技大学鄂州工业技术研究院 Spatial hash continuous collision detection method based on features
CN112848312A (en) * 2021-02-01 2021-05-28 深圳市创想三维科技有限公司 Method and device for detecting three-dimensional model object, computer equipment and storage medium
CN113021900A (en) * 2021-03-19 2021-06-25 山东白令三维科技有限公司 Part model placing method in 3D printing and related device

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
吴兴欢: "3D打印系统中模型放置优化方法研究", 《中国优秀硕士学位论文全文数据库》, no. 1, pages 138 - 1798 *

Also Published As

Publication number Publication date
CN113609667B (en) 2024-03-15

Similar Documents

Publication Publication Date Title
US20110141050A1 (en) Gesture input operation device, method, program, and portable device
CN109408001B (en) Multi-model 3D printing method and device, 3D printing equipment and storage medium
CN102043586B (en) Method and device for displaying background color in electronic form
CN103793178B (en) Vector graph editing method of touch screen of mobile device
CN110704087A (en) Page generation method and device, computer equipment and storage medium
CN105404490A (en) Information processing method and electronic device
CN107766528B (en) Data loading method and terminal for waterfall flow page and computer readable storage medium
CN113386356A (en) Method and device for determining printing starting point, computer equipment and storage medium
CN104112262B (en) A kind of method and electronic equipment of information processing
CN114241032A (en) Area analysis-based region division method, device, equipment and storage medium
CN113609667A (en) Model layout method, model layout device, computer equipment and storage medium
CN113799397A (en) Method, device and equipment for determining printing position of 3D model and storage medium
CN112991161A (en) Method and device for processing and dividing special-shaped curtain wall, computer equipment and storage medium
CN109871517B (en) Text block ordering method and device, storage medium and electronic equipment
CN113752561B (en) Method, device, computer equipment and storage medium for generating 3D printing file
CN113419485B (en) Positioning and punching method, equipment, storage medium and device
CA2390390C (en) Graphics stack system and method
CN115249303A (en) Layout drawing method, device, equipment and storage medium based on drawing segmentation
CN114083800A (en) 3D printing data generation method and device of model supporting surface and storage medium
CN104848872A (en) Fast and convenient navigation method, system and equipment
CN107403087B (en) Touch feedback method and device and terminal
CN113515915B (en) Method, device, equipment and storage medium for inserting filling unit
CN114676389B (en) Motor control method, apparatus, computer device, and storage medium
KR102266073B1 (en) Electronic device that controls the efficient loading of each sheet that makes up a spreadsheet document based on a multi-thread and operating method thereof
CN116010732A (en) Element layout method in window, electronic device and storage medium

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant