Author Topic: SubEntityID  (Read 10737 times)

0 Members and 1 Guest are viewing this topic.

Draftek

  • Guest
SubEntityID
« on: July 13, 2006, 05:37:30 PM »
I've got a solid3d object selected inside a selection set.

I need to get one of the faces objectID's. I can get the GSMarkers but I can't figure out how to get the objectID.

Any clues????

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: SubEntityID
« Reply #1 on: July 13, 2006, 06:20:35 PM »
GetSubentityPathsAtGraphicsMarker should do the trick.
Have a look in the arx section for "Converting GS Markers to Subentity Paths" , it explains what's going on and what's required.
I'll be looking into this myself shortly so I'll geive you a hand where I can.
Cheers,
Mick.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Draftek

  • Guest
Re: SubEntityID
« Reply #2 on: July 14, 2006, 08:08:36 AM »
Thanks Mick,

I'll take a look today.

I'm quite sure I'll be bugging you for some help..

Draftek

  • Guest
Re: SubEntityID
« Reply #3 on: July 14, 2006, 08:39:16 AM »
Forgot to mention: I'm using C# and the managed classes. If I can.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: SubEntityID
« Reply #4 on: July 14, 2006, 07:43:40 PM »
but of course! :D
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Draftek

  • Guest
Re: SubEntityID
« Reply #5 on: July 15, 2006, 09:01:00 AM »
heh, sorry to be caption obvious....

As usual, I solved the immediate problem but the solution was not complete - argh!

Here is what I have:
Code: [Select]
    [CommandMethod("MySolidTest")]
    public void MySolidTest()
    {
      PromptSelectionResult selRes;
      PromptSelectionOptions opts = new PromptSelectionOptions();
      opts.AllowSubSelections = true;
      opts.SingleOnly = true;
      Autodesk.AutoCAD.EditorInput.SelectionSet oSS = null;
      Editor ed = Application.DocumentManager.MdiActiveDocument.Editor;
      Database db = Application.DocumentManager.MdiActiveDocument.Database;
      selRes = ed.GetSelection(opts);
      Transaction trans;
      using (trans = db.TransactionManager.StartTransaction())
      {
        if (selRes.Status != PromptStatus.OK)
        {
          return;
        }
        else
        {
          oSS = selRes.Value;
          for (int i = 0; i < oSS.Count; i++)
          {
            SelectedObject so = oSS[i];
            Entity entity = (Entity)trans.GetObject(oSS[i].ObjectId, OpenMode.ForWrite);
            int gsM = oSS[i].GraphicsSystemMarker;
            ed.WriteMessage("\n GSMarker: " + gsM.ToString());
            Solid3d sol = (Solid3d)entity;
            Point3d pt;
            Matrix3d mat;
            int numIns = new int();
            ObjectId[] ids = null;
            FullSubentityPath[] fsP = sol.GetSubentityPathsAtGraphicsMarker
                (SubentityType.Face, gsM, pt, mat, numIns, ids);
            SubentityId sID = fsP[0].SubentId;
            SubentityId[] sIDs = new SubentityId[] { sID };
            double dTemp = 12.0;
            sol.OffsetFaces(sIDs, dTemp);
          }
        }
      }
      trans.Dispose();
    }

Selecting a face on a solid produces what appears to be a correct SubentityId. It appears to be valid as I did some digging and even tried it out in some of the methods that use it. But, when I try to use it in an array argument like OffsetFaces() above, I get an eInvalidInput error.

I think you can see the significance of how this would work - easily modifiying the lengths of extrusions.

LE

  • Guest
Re: SubEntityID
« Reply #6 on: July 15, 2006, 01:17:36 PM »
Excuse my lack of knowledge here...

GetSubentityPathsAtGraphicsMarker might be a wrapper of getSubentPathsAtGsMarker (arx) ?

Quote
numInserts
Input the number of object IDs for AcDbBlockReferences in entAndInsertStack (should be one less than the total number of entries in entAndInsertStack because the first entry is the entity itself, which is not a BlockReference). If the entity is directly owned by the model or paper space BlockTableRecords, then leave this argument out so its default of 0 will be used.

entAndInsertStack
Input an array of objectIds of the objects that are the nested containers of the subentity. The list is in order from the "main" entity that the subentity is a part of, out to the outermost AcDbBlockReference that is in model or paper space. If the entity is itself directly owned by model or paper space, then leave this argument out so that its default of NULL will be used.

I am guessing that the main entity id cannot be offset.... ?

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: SubEntityID
« Reply #7 on: July 16, 2006, 10:43:25 PM »

I think you can see the significance of how this would work - easily modifiying the lengths of extrusions.

I haven't had much of a go with it but I get the same error. Which version is this for, I don't seem to have 'opts.AllowSubSelections = true' in 2006.

I used to think this was a pain (making solids longer) before I got used to the standard 3d modelling tools such as move/delete faces (holes) and extrude faces (length). The only requirement for making an extrusion longer/shorter is that the end has to be 'square' else your face would extrude along its normal.

The trick to the standard tools is remembering there is only 2 faces to an edge, therefore pick an edge and de-select the unwanted face by its edge. I used to try and pick by face (i.e. inside all edges) but this only made things harder when trying to pick 'through' other solids, ever since I've been using the edge method and it's very quick.
It's also very good for setting up a ucs on a face, very handy.

Just might save you some work ;)
« Last Edit: July 16, 2006, 10:45:37 PM by MickD »
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Draftek

  • Guest
Re: SubEntityID
« Reply #8 on: July 17, 2006, 08:39:28 AM »
LE: I'm not sure I understand what your getting at. Probably over my head at this point.

Mick: It's 2007. I haven't tried to work with 3d solids before, thinking they would be too difficult. but with the built-in dynamic tools I figured there would be a way to duplicate that functionality - like grabbing a face and dragging the length of a solid.

The long term goal is quite a bit more ambitious. I want to create a dynamic grid (frame) of 3d parts that ineract with each other to give the user a drag-and-drop type interface. Originally, I was thinking of a custom object but now I am leaning towards reactors. I don't have to make it idiot-proof but I do want to provide some solid tools.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: SubEntityID
« Reply #9 on: July 17, 2006, 06:05:54 PM »
Yes, just a bit more ambitious! You could use your grids as construction lines and when these lines are changed re-build your model. This will involve a modelling engine and a way to store modifications, you will need this else your reactor code wont know what to change and how. i.e. have your reactors hooked to simple geometry to drive the modeller and links between parts.
I'm not sure about 2007 but the problem is if your solids aren't square on the end, grip/drag editing will not work anyway as you can only drag the face along its normal. If most of your work is square then it shouldn't be a problem.

I'll have to have a closer look at 2007 :)
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Draftek

  • Guest
Re: SubEntityID
« Reply #10 on: July 18, 2006, 06:18:24 AM »
They will all be flat on the end. Some may have some tooling - boolean subtracts but flat just the same.

I had thought of exactly what your talking about with the construction lines - like a simple interface to build the 3d model and then generate the output.

I would rather actually let the user manipulate the model itself if I can figure out how to work it due to what you mentioned with maintaining user editing. The frame members would actually be sub assemblies of parts that may need to be changed out...

I'm still in the discovery stage and have no deadline so I'm going to do quite a bit of research before I start writing any code.

Thanks Mick.

Draftek

  • Guest
Re: SubEntityID
« Reply #11 on: July 19, 2006, 02:37:12 PM »
hmm.. There is a 'height' property in the geometry section of the properties palette that does exactly what I need. Only thing is, I can't figure out how to get to it programmically.

When you grip the block, the face that was originally extruded shows an arrow grip to drag - just like a dynamic block stretch action. Me thinks autodesk internally wrote these things as dynamic 3d blocks but didn't give us access to them due to possible emulation of Inventor features.

Draftek

  • Guest
Re: SubEntityID
« Reply #12 on: July 25, 2006, 03:33:42 PM »
okay, I got the 'official' word - Bug - does not work in the managed classes so you would have to wrap an arx function to expose it to your managed project. I don't think it would be too difficult.


Actually, I'm considering a different approach. My geometry doesn't have to be exact in the way you would think. I can work with simple rectangles as long as they have a correct width, height and lenght for the extrusion. I have been playing with merely changing the thickness of an old solid type or even a closed polyline. I could wrap a simple custom object and manipulate the thickness for the length, rotating the direction of the normal to the x axis for the horizontal pieces. Then control the grid as previously estimated with reactors allowing the user to grip and slide the openings as desired. I can save my database info such as product and pertinent member pieces as members of the object.

With the new 3d viewing ucs manipulation tools, they will look and act like 3d solid objects. I'll have to write some tools for cutting sections and autodimensioning and keeping up with the 'virtual' faces geometry but it might just work.

Anyway, I'm leaning this way (for now). I was going back to 2d because I need to allow the users to manually draw stuff like grids, etc. but to get actual bom I need to be in 3d space I think.

sorry for rambling, I'm starting to get excited...

Kerry

  • Mesozoic relic
  • Seagull
  • Posts: 11654
  • class keyThumper<T>:ILazy<T>
Re: SubEntityID
« Reply #13 on: July 25, 2006, 05:46:11 PM »
Draftek , what is the actual bug ? does it have a case number ?

regards
kwb
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: SubEntityID
« Reply #14 on: July 25, 2006, 06:23:53 PM »
Before heading down the custom object path I'd look at just rebuilding your solid with any changes you need. For example, if your user stretches the construction grid -

- get the info for that grid, ie. position in space, cut planes and lengths with end offsets (these can be stored as xrecs or in xml say ;))
- get your solid associated with that grid
- solid = solid extrude, cut drill and whatever using your modelling info
- your done.

You can change your solid like this anytime, try creating a cube in std acad and write a function that selects the cube and changes it into a sphere.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien

Draftek

  • Guest
Re: SubEntityID
« Reply #15 on: July 26, 2006, 08:11:53 AM »
Kerry: One man's bug is another man's request. I'll pm you in a moment..

Mick: I see what your getting at, but wouldn't I still have to create some persistent reactors to keep the grid synced? So, I'm still going to have a custom object to attach or am I missing something (highly probable).

MickD

  • King Gator
  • Posts: 3636
  • (x-in)->[process]->(y-out) ... simples!
Re: SubEntityID
« Reply #16 on: July 26, 2006, 05:48:49 PM »
You could use reactors to re-build your model or have an 'update model' button to make the changes. It depends on how often you change your model I guess but a change is a change and should be deliberate.
Say you have your grids and they have a link to the members 'attached' to them some how, to change your model, move the grid/construction lines and hit the 'update model' button and watch it re-model using the stored modelling data for each part.
"Programming is really just the mundane aspect of expressing a solution to a problem."
- John Carmack

"Short cuts make long delays,' argued Pippin.”
- J.R.R. Tolkien