-
Notifications
You must be signed in to change notification settings - Fork 511
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Create a POINT_N_COPY from a Vector? #718
Comments
BTW functional board outline importer here: |
If you want the thing you import to be editable, then If you don't want it to be editable, then you could just handle it the same as linked .slvs files, with a special group. Then you could directly generate The default for anything a user draws is |
@jwesthues I don't want it to be editable. Probably should look at how linking works and do that instead. So when linking a file, all the entities are Generated from requests - I didn't realize that. Are the groups Solved as well? Where do these groups from the linked file exist while their SShells, SMeshes, and Entities are being generated? What are the N_ROT_TRANS entities copied from? All that appears in the text window is a single new group. Pointers as to where I need to hook in to do this a simply as possible would be appreciated. I can read enough of the files now so it's just a matter of what to do with the data. |
So the files clearly contain entities and there's LoadEntitiesFromFile() which is called from ReloadAllLinked() which I assume loads entities from linked files. And groups have a member vector named "impEntity" which seems to be where they get read into. In Group::Generate() we see that entities are copied from impEntity by pointer, so the imported/linked entites are not part of the global sketch until those copies are made for the linked group. Linked groups don't seem to have a list of imported requests. So I could create the impEntitys similar to how I was trying before but put the coordinates in the actPoint which is what gets copied from. Could do that twice, once for each side of the board. Creating the impShell may or may not be possible. By keeping the import option we can create the entities via requests and make the extrusion too. The user could then save that as .slvs and link it to get the 3D version of the board for assembly. |
Sorry, my explanation above was incomplete. A .slvs file certainly does contain the entities, but those are used only when the file is linked / assembled. When the file is opened itself, the entities gets regenerated from the requests and groups, and the entities saved in the file are totally ignored. You are correct that requests are ignored when we link (since the only purpose of the requests is to generate the entities, and we're using the saved entities instead of regenerating ourselves). Like the entities, the solid model (triangle or NURBS) is also saved in the .slvs file and used when a part is linked into an assembly, but regenerated from the requests and groups when the part itself is opened. Any entities that you create last only until the next
Does the IDF file format contain any kind of persistent identifiers for each point (so that e.g. if you modified a square outline to add a notch in one side, the four corner points of the overall square would keep the same identifiers)? If yes, then option (2) would let you keep associativity across changes to the board outline (i.e., load the new outline with the notch while constraints against the old corner points still applied to the new corner points), if you used something like the remap mechanism to make the map from that identifier to the Otherwise I suspect that (2) has little benefit over (1), and loses some flexibility--you can simulate option (2) except for the associativity by importing the IDF file into an otherwise blank .slvs file and the linking/assembling that .slvs file, but option (2) makes it fundamentally impossible for the user to edit the outline. For file formats where we have no reasonable user interface for editing (e.g., STL, STEP), that's no loss, but here perhaps it would be. Either way seems reasonable to me, though. |
No, it's just a list of lines, arcs, and circles. They do group them by loop number (they form closed curves), and there is a separate section for drilled holes, but nothing that really looks like it would be persistent if someone moved or added a component. Mounting holes are specifically identified as such, but not uniquely identified. It might be reasonable to assume those get written in the same order but even that depends on the tool that writes the file. This is a good exercise and should result in a very simple code demo of linking other formats. Not sure STEP is any better about persistent IDs than IDF, a tool could persist IDs across saves but I suspect they just write those like line numbers in order to tie points to curves and curves to surfaces strictly within the file. Unless there's some unique ID that I didn't notice while trying and failing to write colors info into STEP. |
Got it, seems like no associativity in any case then. I guess the thorough option would be to provide both (1) and (2) for file formats that we do have a reasonable user interface to edit (like DXF or IDF, or STEP excluding surfaces), and only option (2) otherwise (like STL or STEP including surfaces)? More work, but maybe not that much since most of the effort is correctly parsing the file. |
@jwesthues I've add code intended to Link and IDF file. It's expected to create verticies for line end points and hole centers, but nothing appears on screen. The linking code is past line 250 in importidf.cpp and is similar to the Import, but it doesn't seem to work. I'm hoping you can have a look, as I'm all out of ideas about what's wrong. It does add 30 entities to the list when linking the file xyz.emn in the zip file several comments back, but nothing shows up. Current branch is here: https://github.com/phkahler/solvespace/tree/idf-import Points need to work first, as lines and arcs will reference them by handle. Circles are going to need working points, normals, and distances. I will probably remove IDF import, as it seems like a very low value thing to do. The point is to allow MCAD to build things that fit a design from ECAD and verify fit. |
@jwesthues please disregard, I had to set actVisible = true and forceHidden = false and now the points show up. |
Cool, makes sense. Those are the flags that make it so an entity hidden in the part is always hidden in the assembly (even when the part is shown in the assembly), so they're not relevant for an input file format with no such concept. |
Closing to reduce the number of open issues. |
I'm writing code to import IDF files. It's working ok, but all the points are regular points created by calling one of:
The problem with that is each point has 3 DoF in the solver and that function not only creates a line entity, it creates two point entities. I'd rather do two things:
I've been trying to make these new functions work:
With those functions I want to change my line creation code like this: (the commented lines work)
The existing way works and is similar to DXF import, but it creates disconnected entities. DXF import constrains coincident points, but I'd rather just use the same points and have zero DoF by using POINT_N_COPY type. I can make lines share points after this direct replacement is working. Also, where can I get the correct style from? It seems like every place in the code that sets a style member copies another one which I don't have here.
The text was updated successfully, but these errors were encountered: