As in the topic - i want to prevent deleting blocks which were created by my plugin on purge command is there any way for doing this?
I mean of course i can listen to commands and take action like: Command_BeginCommand / Command_EndCommand to add those to doc and then delete them ( can’t just re-add them after purge cause guids will change ) but maybe there other better way to handle this discreetly?
@Terry_Chappell what do you mean hiding? My blocks aren’t in doc they exist only in instance definition table thats my case - i pick them from table and process differently but since they are not in doc directly they can be purged and i don’t want that.
So you could put them in the doc and take them back after the purge. It seems you need a copy of them somewhere else. I do not use blocks in this way so I cannot give you very specific advice.
@dale by the way i also wanted to ask is there a possibility to turn on snapping for objects drawn by Rhino.Input.Custom.GetPoint.DynamicDraw ?
@dale i also don’t understand why when i want to add block object to the scene it’s not using its insertion point but it takes center of base of its bbox ?
var instanceIdx = Rhino.RhinoDoc.ActiveDoc.InstanceDefinitions.Find(definitionId, true).Index;
Rhino.RhinoDoc.ActiveDoc.Objects.AddInstanceObject(instanceIdx, Transform.Identity);
Does C++ equivalent behave the same way? This is super important for me… As far as i understand getter is returning such data? This behavior is odd since when i convert entire definition to mesh it is exactly the mesh as it would use insertion point while when receiving instance insertion point isn’t taken into account? Am i missing something here? How do i access insertion point from instance definition ? Theres no such thing … https://developer.rhino3d.com/5/api/RhinoCommon/html/T_Rhino_DocObjects_InstanceDefinition.htm
and on the other hand when adding definition insertion point is needed https://developer.rhino3d.com/5/api/RhinoCommon/html/M_Rhino_DocObjects_Tables_InstanceDefinitionTable_Add_1.htm
Only way to access insertion point is to add InstanceObject do the scene then read its point and transform then block? Isn’t that just confusing?
If you want object snapping in a GetPoint operation, then set the osnap modes you want before calling GetPoint.Get() and reset them when finished. You also add custom snap points to your GetPoint object (if that’s what need).
You need to pass a transformation, other than Transform.Identity.
Other than Identity? Isn’t Transform.Scale(Point3d.Origin,1) the same as Identity? I would like to discuss this thing since it is weird that insertion point isn’t available in instance definition at all and adding instance behaves differently than everywhere else in the program (Insert command takes insertion point into account) don’t you think?
I hope you get my point i can’t even move it to proper position since base point isnt availible i have to add instance object then read its insertion point delete it and add again ? or transform each time after adding back to place ? This is bit nuts?
Look red one is extracted render mesh durig dynamic draw - gray one is added using ActiveDoc.Objects.AddInstanceObject(instanceIdx, Transform.Identity); And i exactly want to place it at Origin so i don’t get why i cannot use Identity besides any other equal transform like scale eg. or Transform.Translation(Vector3d.Zero) gives the same results …
[EDIT] I tried with Transform.Translation(Vector3d.XAxis) and it is still transforming it from bbox center instead of base point… i could move it right away back to point but its not availible from instance definition thats the issue… Besides its just unconsitent across api sdk - why render meshes of it are on place and definiton itself is not ?
[EDIT2] @dale i don’t have any clue why but … system reboot solved my issue - i don’t have any idea what went wrong but now after the reboot and solution rebuild all is working as it should Weird… Sorry for the inconvenience if it will happen again i’ll report this send whole code + file.